Ruled surface between two spline curves with different control point spacing

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Ruled surface between two spline curves with different control point spacing

Post by edwilliams16 »

I was curious as to how this works mathematically. If we can't re-parameterize a BSpline curve without changing it, why does segmenting the curves and making a ruled surface segment by segment effectively do just that?


The recursion formula for the BSpline Basis functions is:
Screen Shot 2022-08-17 at 9.34.04 AM.png
Screen Shot 2022-08-17 at 9.34.04 AM.png (11.01 KiB) Viewed 1054 times
You can see that linear transformations of the form t -> at + b do not affect the BSpline. They are all effectively on [0, 1]. When we segment the curves, we effectively do a piecewise linear parameterization of the curve. Ruled surfaces by construction connect up equal u-values, but on a segment (and normalized to [0, 1] ) basis.

Geometrically it is clear. If I segment the curves and connect them up - endpoints get connected up that otherwise would not have been, because their original u-values were different.
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Ruled surface between two spline curves with different control point spacing

Post by onekk »

Probably found a solution.

https://forum.freecadweb.org/viewtopic. ... 94#p618994

I have to check if segmenting the bspline and join them in a Wire is preserving the shape.

hope it helps.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
domad
Veteran
Posts: 2053
Joined: Mon Jun 22, 2020 12:16 pm

Re: Ruled surface between two spline curves with different control point spacing

Post by domad »

snow54 wrote: Tue Aug 16, 2022 3:08 am .......
Hi snow54, greetings to the Community!

Using the Wb "Surface" the result in the attached image, but I don't know if that's what you were hoping to get, in any case the modeling flow file is attached.
Attachments
rulesurf_spline2.FCStd
(31.39 KiB) Downloaded 18 times
rulesurf_spline2.png
rulesurf_spline2.png (133.13 KiB) Viewed 969 times
snow54
Posts: 17
Joined: Sat Apr 24, 2021 8:42 am
Location: Japan

Re: Ruled surface between two spline curves with different control point spacing

Post by snow54 »

onekk wrote: Thu Aug 18, 2022 3:01 pm Probably found a solution.

https://forum.freecadweb.org/viewtopic. ... 94#p618994
Thank you for finding the solution. I have downloaded the script you created but I have been struggling to reproduce the upper geometry in the capture you have in your post. Do I have to do something other than running the script?
snow54
Posts: 17
Joined: Sat Apr 24, 2021 8:42 am
Location: Japan

Re: Ruled surface between two spline curves with different control point spacing

Post by snow54 »

domad wrote: Thu Aug 18, 2022 4:24 pm Hi snow54, greetings to the Community!

Using the Wb "Surface" the result in the attached image, but I don't know if that's what you were hoping to get, in any case the modeling flow file is attached.
Hello! The result looks very promising. I have been trying to reproduce what you have done. How did you create a wire that passes through the four corners? I used Polyline in Draft WB but it only lets me create a polyline on a working plane and the corner points are not always on it.
domad
Veteran
Posts: 2053
Joined: Mon Jun 22, 2020 12:16 pm

Re: Ruled surface between two spline curves with different control point spacing

Post by domad »

snow54 wrote: Fri Aug 19, 2022 1:47 pm ...
Hello! The result looks very promising. I have been trying to reproduce what you have done. How did you create a wire that passes through the four corners? I used Polyline in Draft WB but it only lets me create a polyline on a working plane and the corner points are not always on it.
Hi snow54, greetings to the Community!

The animated gif shows the steps to take ...
Attachments
rulesurf_spline2.gif
rulesurf_spline2.gif (442.88 KiB) Viewed 867 times
User avatar
onekk
Veteran
Posts: 6144
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Ruled surface between two spline curves with different control point spacing

Post by onekk »

snow54 wrote: Fri Aug 19, 2022 1:14 pm Thank you for finding the solution. I have downloaded the script you created but I have been struggling to reproduce the upper geometry in the capture you have in your post. Do I have to do something other than running the script?
The code should reproduce things as the posted image.

Let me return home and I will check and post code here.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
edwilliams16
Veteran
Posts: 3106
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Ruled surface between two spline curves with different control point spacing

Post by edwilliams16 »

onekk wrote: Fri Aug 19, 2022 4:08 pm
The code should reproduce things as the posted image.
Works for me...

Here's a version of your macro where I just insert uniformly spaced knots in the original B-Splines. In theory, the result should be the same as yours except the surface is not segmented.
Attachments
testonekksplitruled.py
(5.72 KiB) Downloaded 18 times
Screen Shot 2022-08-19 at 7.56.19 AM.png
Screen Shot 2022-08-19 at 7.56.19 AM.png (56.82 KiB) Viewed 796 times
snow54
Posts: 17
Joined: Sat Apr 24, 2021 8:42 am
Location: Japan

Re: Ruled surface between two spline curves with different control point spacing

Post by snow54 »

domad wrote: Fri Aug 19, 2022 2:45 pm The animated gif shows the steps to take ...
Thank you for posting the animated gif. It works quite well as long as boundary curves are independent curves. Once the boundary curves become a part of another surface, it causes an error without any error message as shown below. Do you have any clue why this occurs?
Screenshot from 2022-08-20 11-26-52.png
Screenshot from 2022-08-20 11-26-52.png (148.67 KiB) Viewed 749 times
Attachments
test_surface.FCStd
(24.48 KiB) Downloaded 14 times
snow54
Posts: 17
Joined: Sat Apr 24, 2021 8:42 am
Location: Japan

Re: Ruled surface between two spline curves with different control point spacing

Post by snow54 »

edwilliams16 wrote: Fri Aug 19, 2022 5:58 pm
onekk wrote: Fri Aug 19, 2022 4:08 pm
The code should reproduce things as the posted image.
Works for me...
Thank you, Carlo and edwilliams16. Once I restarted FreeCAD, it worked. I don't know what was wrong. Am I right in understanding that this method is equivalent to the workaround in my post below except that it is automated?
https://forum.freecadweb.org/viewtopic. ... 26#p618633
edwilliams16 wrote: Fri Aug 19, 2022 5:58 pm
Here's a version of your macro where I just insert uniformly spaced knots in the original B-Splines. In theory, the result should be the same as yours except the surface is not segmented.
The one you added is very different from what Carlo created and is very similar to the original skewed surface as evident in the capture below. It seems that adding the inserting knots does not solve the issue.
Screenshot from 2022-08-20 12-16-17.png
Screenshot from 2022-08-20 12-16-17.png (53.39 KiB) Viewed 729 times
Post Reply