[Sketcher] Any suggestions on improving B-Spline knot insertion?

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
flachyjoe
Veteran
Posts: 1891
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: [Sketcher] Any suggestions on improving B-Spline knot insertion?

Post by flachyjoe »

If I don't mistake the knot insertion can be used to make the point onto object constraint working with B-Splines. :?
- Flachy Joe -
Image
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: [Sketcher] Any suggestions on improving B-Spline knot insertion?

Post by jnxd »

flachyjoe wrote: Fri Mar 11, 2022 12:09 pm If I don't mistake the knot insertion can be used to make the point onto object constraint working with B-Splines. :?
Unfortunately it is not that straightforward. A knot only tells where along the curve there is a "break". We can add a high multiplicity knot and fix it, but we lose tangent continuity because of that.
My latest (or last) project: B-spline Construction Project.
User avatar
flachyjoe
Veteran
Posts: 1891
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: [Sketcher] Any suggestions on improving B-Spline knot insertion?

Post by flachyjoe »

jnxd wrote: Fri Mar 11, 2022 3:51 pm Unfortunately it is not that straightforward. A knot only tells where along the curve there is a "break". We can add a high multiplicity knot and fix it, but we lose tangent continuity because of that.
What I have in mind is creating a knot at edge/spline intersection and recalculate it after every spline change. The inserted knot will be a kind of non-piloting one.

As the knot insertion doesn't change the spline shape, it's currently usable this way:
original spline
Capture d’écran_2022-03-12_12-09-49.png
Capture d’écran_2022-03-12_12-09-49.png (11.2 KiB) Viewed 1147 times
add a knot
Capture d’écran_2022-03-12_12-10-18.png
Capture d’écran_2022-03-12_12-10-18.png (12.2 KiB) Viewed 1147 times
coincidence constraint
Capture d’écran_2022-03-12_12-10-41.png
Capture d’écran_2022-03-12_12-10-41.png (12.8 KiB) Viewed 1147 times
but spline is no more editable with original control points…
- Flachy Joe -
Image
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: [Sketcher] Any suggestions on improving B-Spline knot insertion?

Post by jnxd »

flachyjoe wrote: Sat Mar 12, 2022 11:14 am What I have in mind is creating a knot at edge/spline intersection and recalculate it after every spline change. The inserted knot will be a kind of non-piloting one.
I think you're not getting the point: any knot inserted effectively makes a different curve, and there is a discontinuity (at some derivative) inserted for every knot.
As the knot insertion doesn't change the spline shape, it's currently usable this way:
original spline
Capture d’écran_2022-03-12_12-09-49.png
add a knot
Capture d’écran_2022-03-12_12-10-18.png
coincidence constraint
This should not be possible.
Capture d’écran_2022-03-12_12-10-41.png

but spline is no more editable with original control points…
As I said this is because now the curve has been changed. Turn on "curvature comb" and try moving the new control points. You will already see the curvature comb is visibly different after knot insertion. After changing the new control points, you'll see that the curvatures at the inserted knot are no longer the same (so long as it is cubic, which your example is).
My latest (or last) project: B-spline Construction Project.
User avatar
flachyjoe
Veteran
Posts: 1891
Joined: Sat Mar 31, 2012 12:00 pm
Location: Limoges, France

Re: [Sketcher] Any suggestions on improving B-Spline knot insertion?

Post by flachyjoe »

jnxd wrote: Sat Mar 12, 2022 5:03 pm This should not be possible.
Ok not this way. :oops:

Let me have another try ;)
You already implement a "point onto BSpline" with knot insertion preview, can't we use this algorithm to add a point (not a knot) at a given place ?
- Flachy Joe -
Image
User avatar
jnxd
Posts: 951
Joined: Mon Mar 30, 2015 2:30 pm
Contact:

Re: [Sketcher] Any suggestions on improving B-Spline knot insertion?

Post by jnxd »

flachyjoe wrote: Sat Mar 12, 2022 5:36 pm You already implement a "point onto BSpline" with knot insertion preview, can't we use this algorithm to add a point (not a knot) at a given place ?
This is very much a possibility, but there are some caveats:
1) Unlike, say, a point on a circle, a point on b-spline will end up being fixed in terms of the parameter. This could just be a limitation in my knowledge however.
2) (If the fixed parameter limitation can be removed) there is also a question of whether to limit this to just the fully continuous sections of the b-spline (i.e. between consecutive knots). For example, a slot can be completely approximated with nurbs. Then do we want to specify a point lies on the circular/linear portion, or on the entire slot?
My latest (or last) project: B-spline Construction Project.
Post Reply