How to use sketcher B-spline tool

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!
PaulWray
Posts: 13
Joined: Fri May 25, 2018 5:34 am

How to use sketcher B-spline tool

Postby PaulWray » Tue Aug 07, 2018 6:29 am

Is there any help/tutorial/info on how to use the B-spline tool in the sketcher workbench. Eg how to add/delete points, how to create a closed curve, how to constrain etc. (Clearly, Im new to FreeCAD)
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: How to use sketcher B-spline tool

Postby microelly2 » Tue Aug 07, 2018 7:16 am

Hello PaulWray and welcome to the forum

There are two kinds of BSpines in Sketcher:
the "open" and the periodic/"closed" spline
you can select them from the menu.
To create a spline you start the command and click some control points in the right order
at the end press ESC to get the curve.
there is at the moment no method to add/delete control points.
in such a case you have to recreate the complete spline again.
you only can constraint the position of the controlpoints the same way as you constraint other points.

you can play a bit around and ask if something is not clear.
To get better constraints to the curves I use special methods like Bezier curves . These are not in the core FreeCAD Sketcher.
To get an idea what is possible see
phpBB [video]
PaulWray
Posts: 13
Joined: Fri May 25, 2018 5:34 am

Re: How to use sketcher B-spline tool

Postby PaulWray » Wed Aug 08, 2018 1:48 am

Thanks. I had not realised that the periodic b-spline meant closed.
Its a very nice tool indeed. I have a lot of questions, but clearly most of these require deep knowledge of the math. Still no harm in asking I guess...

With regard to the weights, it seems that they are only meaningful in relation to each other, correct?. Eg if all weights are the same, the actual value is irrelevant. Similarly, if the weights are different, does increasing/decreasing all weights by a constant multiple leave the curve unchanged?

If you want to approximate a known curve with a given number of control points, is there an optimal manual procedure to adjust the control point positions and weights? (Some sort of least squares analysis would be nice!)

I am guessing that adding an extra control point (keeping weights the same) gives you about the same equivalent increase in curve matching accuracy as does adjusting one weight to be different from the others. Or does adjusting weights give access to different families of curves not accessible otherwise, or confer some specific benefit?

Finally, if you wanted to parametrically describe, or generate, a family of shapes (eg human faces) by using landmarks (eg the tip of the nose), you're starting with points on the curve rather than the control points. It would be great to be able to switch between these representations, if that is possible.
User avatar
microelly2
Posts: 4690
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: How to use sketcher B-spline tool

Postby microelly2 » Wed Aug 08, 2018 7:59 am

PaulWray wrote:
Wed Aug 08, 2018 1:48 am
Thanks. I had not realised that the periodic b-spline meant closed.
Its a very nice tool indeed. I have a lot of questions, but clearly most of these require deep knowledge of the math. Still no harm in asking I guess...
there are 4 sources you should study:
The Nurbs book by Piegl, Tiller
The nurbs editor thread https://forum.freecadweb.org/viewtopic.php?f=3&t=16473
The curves workbench thread https://forum.freecadweb.org/viewtopic.php?f=8&t=22675
The shoelast thread https://forum.freecadweb.org/viewtopic.php?f=3&t=20525
With regard to the weights, it seems that they are only meaningful in relation to each other, correct?. Eg if all weights are the same, the actual value is irrelevant. Similarly, if the weights are different, does increasing/decreasing all weights by a constant multiple leave the curve unchanged?
Yes, weights are very special parameters and should only be changed by operations in background for example projective mappings like stretching operations.
BSplines are simply said projections from the 4 dimensional space to our 3D and the weights are the 4th dimension.

If you want to approximate a known curve with a given number of control points, is there an optimal manual procedure to adjust the control point positions and weights? (Some sort of least squares analysis would be nice!)
I use for design Bezier Curves which are special cases of BSplines. Inkscape is a good example how to design such drawings.
There are some approximations too.
https://youtu.be/wa4K7vodTYM
https://youtu.be/iF29eFrHoFI
I am guessing that adding an extra control point (keeping weights the same) gives you about the same equivalent increase in curve matching accuracy as does adjusting one weight to be different from the others. Or does adjusting weights give access to different families of curves not accessible otherwise, or confer some specific benefit?
Nurbs are very complex data object. We have to look for ways to simply the models. Splitting a face into ribs and meridians (curves) which are editable is a big step. If the ribs can be designed as sketches - real 2D another big step to powerful tools is possible.
If we cannot do these simplifications we have to edit the face as a whole. I restarted the work on the nurbs editor and the interface is already very complex, Any controlpoint of a Bezier Surface has 8 neighbors, this means 24 parameters to zoom/stretch, rotate etc.
In most cases the impact of weights is not essential. I only use them for arc approximation.
Finally, if you wanted to parametrically describe, or generate, a family of shapes (eg human faces) by using landmarks (eg the tip of the nose), you're starting with points on the curve rather than the control points. It would be great to be able to switch between these representations, if that is possible.
look through my videos to see what is possible.
I've been working on nurbs with FreeCAD for 2 years. Meantime the core methods are very stable.
try your first simple examples and feel free to ask.
PaulWray
Posts: 13
Joined: Fri May 25, 2018 5:34 am

Re: How to use sketcher B-spline tool

Postby PaulWray » Wed Aug 08, 2018 11:43 am

I will look through the videos and docs you referenced. Thanks so much for taking the time for a complete reply!
nic
Posts: 77
Joined: Thu Apr 18, 2019 1:14 pm
Location: France

Re: How to use sketcher B-spline tool

Postby nic » Fri May 22, 2020 1:45 pm

microelly2 wrote:
Tue Aug 07, 2018 7:16 am

there is at the moment no method to add/delete control points.
in such a case you have to recreate the complete spline again.
The quoted post is from 2018. Is there something new in 0.19? Can we add/remove points from a b-spline?
chrisb
Posts: 27938
Joined: Tue Mar 17, 2015 9:14 am

Re: How to use sketcher B-spline tool

Postby chrisb » Fri May 22, 2020 3:41 pm

nic wrote:
Fri May 22, 2020 1:45 pm
Can we add/remove points from a b-spline?
No.
GeneFC
Posts: 1567
Joined: Sat Mar 19, 2016 3:36 pm
Location: Punta Gorda, FL

Re: How to use sketcher B-spline tool

Postby GeneFC » Sat May 23, 2020 12:23 am

chrisb wrote:
Fri May 22, 2020 3:41 pm
No.
TL/DR :lol: :lol: :lol: :lol:

Gene
chrisb
Posts: 27938
Joined: Tue Mar 17, 2015 9:14 am

Re: How to use sketcher B-spline tool

Postby chrisb » Sat May 23, 2020 4:44 am

GeneFC wrote:
Sat May 23, 2020 12:23 am
TL/DR
:lol: First laugh this morning - thanks.

Here is the long version:

"No, we can't."
User avatar
hammax
Posts: 1191
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee

Re: How to use sketcher B-spline tool

Postby hammax » Sat May 23, 2020 6:16 am

… a short comic - hoping it helps. Another way to create a bspline.
(you can delete "knot points" without risk, they are useless and disturb => I do it often)

BSpline_4_2.PNG
BSpline_4_2.PNG (115.89 KiB) Viewed 1558 times
Attachments
BSpline.FCStd
FC.18.4
(4.72 KiB) Downloaded 17 times