B-Spline improvements

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

B-Spline improvements

Post by abdullah »

I have reworked the b-spline creation to fix some of the issues, especially the selection of the pole instead of the endpoint of the b-spline.

It includes:
1. The constraint extended identification
2. Now points also respect the rendering order, not only the lines. This means that, with the default rendering order, the points of normal geometries are rendering over the points of construction geometry. This means the point of the pole circles are rendered lower than the points of a normal b-spline.
3. The creation of b-splines has been improved, so that autoconstraints on the endpoints of the b-spline operate on the b-spline edge, as it should (before the end poles where autoconstrained, which resulted in many issues).

Overall most of the operations with B-Splines that were causing problems should be solved now.

I leave this appimage for those intrepid users who would like to test, and let me know their feedback:
https://github.com/abdullahtahiriyo/Fre ... 4.AppImage
User avatar
hammax
Veteran
Posts: 1994
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee DE

Re: B-Spline improvements

Post by hammax »

… I am actually working/testing with FC0.18.13870
and made another test with periodic BSpline in Sketcher.
After my opinion the starting (and end) point of the BSpline should logically posess the visible and undeletable point.
And not the 2nd knot.
Is this irritation corrected at least in your newest rework?

BSpline_3.PNG
BSpline_3.PNG (87.14 KiB) Viewed 4091 times
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: B-Spline improvements

Post by abdullah »

hammax wrote: Fri Jun 01, 2018 4:43 pm Is this irritation corrected at least in your newest rework?
No it is not, because the point you see is not the knot, but the start and endpoint of a periodic bspline.

It may be possible not to show those points when a bspline is periodic, however the "seed" you see when lofting or padding won't go away. Just make a circle in a sketch and pad it, you will see a seed too.
User avatar
hammax
Veteran
Posts: 1994
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee DE

Re: B-Spline improvements

Post by hammax »

… sorry to contradict.
I experienced this behavior since some time and it's the cause for me, not to use Periodic Sketcher-BSpline.
I rather take a normal BSpline and connect starting and endpoint via tangential poles at each side.

In the picture the starting point is at Y-axis at the tip of the green arrow.
This is confirmed by the constrained pole-circle - if the seedpoint would be the starter, the rad-constrained circle would/must be there.
But the following point (knot) is the undeletable "Seed-point".
I hope that this is not a special bug in Win10-32.
Attachments
BSpline.FCStd
FC.18.13870
(5.38 KiB) Downloaded 59 times
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: B-Spline improvements

Post by abdullah »

hammax wrote: Sat Jun 02, 2018 4:42 pm … sorry to contradict.
I experienced this behavior since some time and it's the cause for me, not to use Periodic Sketcher-BSpline.
I rather take a normal BSpline and connect starting and endpoint via tangential poles at each side.
It is never a problem to contradict. I think there is some kind of misunderstanding or bug. Let's try to understand each other:

1. You are not complaining that the extruded part has a seed. You accept it will have a seed, like circles do, but you complain about the position of the seed:
BSpline.FCStd
(6.9 KiB) Downloaded 60 times
example_bspline_seeds.png
example_bspline_seeds.png (38.45 KiB) Viewed 4002 times
This shows a periodic b-spline, a normal b-spline and a circle.

a. All of them generate a seed.
b. The seed is where the start and end points of the period shape meet.
c. In the circle, care has been taken that no point is shown in the sketcher at this point. In the periodic B-Spline it should be possible to do this as well.
example_bspline_seeds1.png
example_bspline_seeds1.png (11.7 KiB) Viewed 4002 times
2. From a mathematical/geometric point of view a normal b-spline has a starting point that coincides in position with the first knot and first pole and an endpoint which coincides in position with the last knot and last pole. This is because the first knot multiplicity is made to be the degree. See a (4) in the normal b-spline. A periodic b-spline has a (1) multiplicity on each knot. Such a b-spline has a starting point coinciding with the first knot and an endpoint coinciding with the last point. However, there is no pole at that position!!

z.B.:
https://www.globalspec.com/reference/61 ... ine-curves

3. What is exactly irritating. I mean, which effect do you have in your normal CAD operations where this causes disturbance?

P.S.:
Another way you have to know if a point is a knot or not, is to look for "points" in the Elements Widget of the sketcher, if there are no "Points" what you see is part of the edge itself.
User avatar
hammax
Veteran
Posts: 1994
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee DE

Re: B-Spline improvements

Post by hammax »

… if I want to design hull frames e.g. for an airplane, I start at the top and make by constraint a symmetric shape.
It would be logical, when the hull line made by the seedpoint could also be at the ridge of my hull.
And I therefore always know, where/how my sketch is positioned.
The same mark would be fine for all other streamlined profiles, airplane, ship and so on.
Another point of interest would be the possibility to delete the knots, because they are useless (not constrainable, only informal=blue).
I delete them to get a better snap of the poles. And here the "seedpoint" is a little bit stubborn and offtopic.
At starting/end point it would be of some informal use. (leading edge, trailing edge)

BSpline_6.PNG
BSpline_6.PNG (108.19 KiB) Viewed 3990 times
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: B-Spline improvements

Post by abdullah »

hammax wrote: Sun Jun 03, 2018 7:51 am … if I want to design hull frames e.g. for an airplane, I start at the top and make by constraint a symmetric shape.
It would be logical, when the hull line made by the seedpoint could also be at the ridge of my hull.
And I therefore always know, where/how my sketch is positioned.
The same mark would be fine for all other streamlined profiles, airplane, ship and so on.
Ok. This is what I wanted to know. I will give it a thought.
hammax wrote: Sun Jun 03, 2018 7:51 am Another point of interest would be the possibility to delete the knots, because they are useless (not constrainable, only informal=blue).
I delete them to get a better snap of the poles.
The knots are only useless if you do not need/what to change their multiplicity. But I understand what you mean.
hammax wrote: Sun Jun 03, 2018 7:51 am Another point of interest would be the possibility to delete the knots, because they are useless (not constrainable, only informal=blue).
I delete them to get a better snap of the poles. And here the "seedpoint" is a little bit stubborn and offtopic.
At starting/end point it would be of some informal use.
What you are looking at are not the knots, though they coincide in position with the knots, but they are the representation of the start and end points. This can be handled (I can make them disappear), but they won't move the seed as you would like to. So I have to think about a more global solution.
User avatar
hammax
Veteran
Posts: 1994
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee DE

Re: B-Spline improvements

Post by hammax »

… many thanks for thinking over other's problems.
And don't forget the newbies and their understanding of the periodic BSpline:
https://forum.freecadweb.org/viewtopic. ... 94#p237094
dbecad
Posts: 80
Joined: Fri Mar 16, 2018 11:10 pm

Re: B-Spline improvements

Post by dbecad »

Thanks Abdullah for all your work on these topics.

The question I have is would it be possible to either extend or add interpolating spline tool to part design?
Some time you want to interpolate a curve through some measured key points an maybe the control over the order of curvature / knot weight is less important.

I'm taking about something similar to the b-spline tool in draft WB, even if it might be more accurate to call them centripetal/catmull-Rom spline
https://en.wikipedia.org/wiki/Centripet ... Rom_spline

They do have a lot of really interesting properties as they are nicely behaved, stay local and never diverge/loop even when control points are close together, you can also set the tangent at the beginning/end to connect with the rest of sketches elements and generate close loop with them. But the most important feature is you control the curve with way points, not knots that have no relation with the end result.

Hope this is the right location to talk about that, I could start a new thread.
thanks for your work!
Cheers
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: B-Spline improvements

Post by abdullah »

dbecad wrote: Sun Jun 03, 2018 7:50 pm The question I have is would it be possible to either extend or add interpolating spline tool to part design?
Some time you want to interpolate a curve through some measured key points an maybe the control over the order of curvature / knot weight is less important.
It is the right place to ask for it. I thought of it a while ago, but I have not developed it. Please make a ticket in the tracker (if none present), so that I do not forget.
Post Reply