Ruled surface between two spline curves with different control point spacing
Forum rules
and Helpful information
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!
Also, be nice to others! Read the FreeCAD code of conduct!
-
- Veteran
- Posts: 3180
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Ruled surface between two spline curves with different control point spacing
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: 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.
The recursion formula for the BSpline Basis functions is: 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.
Re: Ruled surface between two spline curves with different control point spacing
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.
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/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
Re: Ruled surface between two spline curves with different control point spacing
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 (133.13 KiB) Viewed 1004 times
Re: Ruled surface between two spline curves with different control point spacing
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?onekk wrote: ↑Thu Aug 18, 2022 3:01 pm Probably found a solution.
https://forum.freecadweb.org/viewtopic. ... 94#p618994
Re: Ruled surface between two spline curves with different control point spacing
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.
Re: Ruled surface between two spline curves with different control point spacing
Hi snow54, greetings to the Community!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.
The animated gif shows the steps to take ...
- Attachments
-
- rulesurf_spline2.gif (442.88 KiB) Viewed 902 times
Re: Ruled surface between two spline curves with different control point spacing
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/
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.
Blog: https://okkmkblog.wordpress.com/
-
- Veteran
- Posts: 3180
- Joined: Thu Sep 24, 2020 10:31 pm
- Location: Hawaii
- Contact:
Re: Ruled surface between two spline curves with different control point spacing
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 (56.82 KiB) Viewed 831 times
Re: Ruled surface between two spline curves with different control point spacing
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?
- Attachments
-
- test_surface.FCStd
- (24.48 KiB) Downloaded 14 times
Re: Ruled surface between two spline curves with different control point spacing
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
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.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.