Sketcher: Bezier curves

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!
jean.thil
Posts: 209
Joined: Tue Jul 28, 2015 7:28 am

Re: Sketcher: Bezier curves

Post by jean.thil »

abdullah wrote:
3. What are you missing? (other than knots, knots are the next stage)
You told me to remind you in case of...

Code: Select all

BSpline: Not yet supported geometry for external geometry
Failed to add external geometry: Not able to add external shape element
:oops:
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Sketcher: Bezier curves

Post by microelly2 »

NormandC wrote: Sorry for asking, keep in mind I have no knowledge of the math behind B-splines, and no amount of links to technical papers will make me understand it. :oops:

To my question: what would knots bring to the B-spline? What can knots do that control poles can't?
See a curve as a hanging bridge and the poles are the direction of the forces. The weight of a pole is the quantitiy of a force.
The placement of the poles gives the direction of the forces.
The knots control where the forces grasp the bridge. Think the connection between poles and knots as ropes.
The subcurve between two knots is a segment.
For a degree 3 nurbs one pole is connected to 4 poles and influences 3 segments. And any segment is under control of 4 poles.
A useful analogy is a jumping sheet. If there are only 3 people (the poles) who can hold it one of them must hold two corners(the knots). That means the sheet will collapse at this side.
Adding a knot will restrict the influence of poles, so multiple knots/knots with higher multiplicity can force hard edges.
To use all of this some experience is neccessary and it will take some time to "learn" a nurbs editor as sculpting is an art.
I made a demo some time ago https://www.youtube.com/watch?v=H-_XNOpCQb4
In the later part of the vidoe the influce of the knots (pink points) is demonstrated.

And I love these classical construxction methods
http://www.frets.com/FretsPages/Luthier ... ights.html
http://www.alatown.com/spline-history-architecture/

There are fine differences between multiple poles and multiple knots and moving them around. Knotes are not for beginners but they bring extra freedom for design and cannot substituded by weights and poles.
To get the sphere a higher multiplicity of knots is required.
https://forum.freecadweb.org/viewtopic. ... 87#p160851
User avatar
Chris_G
Veteran
Posts: 2598
Joined: Tue Dec 31, 2013 4:10 pm
Location: France
Contact:

Re: Sketcher: Bezier curves

Post by Chris_G »

abdullah wrote:1. When working you add a number of poles, it is not strange that this number happens to be too small or too high. Then you have to delete your B-Spline and make a new one with an appropriate number.

Possible solutions:
a) A tool to delete one pole.
b) A tool to split a bspline in two at a given pole
c) A tool to join bsplines (how? what if different degrees)
d) A tool that given a bspline approximates the Bspline using a "lower degree" or "lower amount of poles".

2. It is a nightmare to lock these beasts.

Any idea?


Separately:

3. What are you missing? (other than knots, knots are the next stage)
Hi Abdullah,
First, thanks again for your amazing work !

I agree that the problem you describe in 1.) needs a solution.
a) Adding / deleting poles would be really useful (first priority, IMHO)
b) Splitting at a given KNOT would make more sense, no ?
c) I don't know if this will help but Part WB already has a join function (and I think it works with different degrees):

Code: Select all

BSplineCurve1.join(BSplineCurve2)
d) It could be useful, although I think it is first up to the user to design with as few poles as possible.

Chris
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: Sketcher: Bezier curves

Post by looo »

Chris_G wrote:a) Adding / deleting poles would be really useful (first priority, IMHO)
+1
abdullah wrote:d) A tool that given a bspline approximates the Bspline using a "lower degree" or "lower amount of poles".
I find this possibility very nice. But maybe it isn't that suited for all use cases. In our glider-wb we have implemented a tool which allows us to higher or lower the pole-number of shape-defining splines by least-square approximation. It's also possible to change the bspline degree or switch between bezier and bspline. Little demo: https://raw.githubusercontent.com/booya ... owcase.gif
For bspline and beziers this works good. While making the number of poles higher doesn't influence the spline-geometry, a lower number of poles makes the spline smoother. But with weighted bsplines this is for sure more difficult, as the weights would also be unknown. Dealing with knots is also another difficulty.

But I am sure you will come up with a great tool. :D
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Sketcher: Bezier curves

Post by microelly2 »

abdullah wrote:d) A tool that given a bspline approximates the Bspline using a "lower degree" or "lower amount of poles".
Because there are different ways to approximate I would not put this functionality into the sketcher.
https://youtu.be/6ly86bF0sUc

there are alredy good methods
http://freecadbuch.de/doku.php?id=blog: ... roximieren

Adding/Deleting a pole should preserve the layout at the first step.So a approximation is required too.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Bezier curves

Post by abdullah »

jean.thil wrote:
abdullah wrote:
3. What are you missing? (other than knots, knots are the next stage)
You told me to remind you in case of...

Code: Select all

BSpline: Not yet supported geometry for external geometry
Failed to add external geometry: Not able to add external shape element
:oops:
https://forum.freecadweb.org/viewtopic. ... 30#p159603

;)
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Bezier curves

Post by abdullah »

I have quickly read the previous posts. Thank you for your feedback.

I realize I have to think it through a little bit more. You have provided great information that I need to digest.

In the meanwhile, the second deliverable has made its way into master. This means that a lot of features will go / is going / has gone mainstream to the daily builds. As always, I encourage you to use the functionality therein and be critical and come with suggestions / bugs / improvements.

While I have improved my knowledge of B-Splines considerably in the last month (well, not difficult, I did know nothing), every time I add some functionality I feel like I am almost making a discovery, only to discover that it is known for 40 years... well, bear with me :)

Today I just comment on this one:
NormandC wrote:Might this tool also allow the reverse, that is raise the degree/raise amount of poles?
In the last deliverable, just merged, there is a new toolbar, the BSpline toolbar. There you will find a tool to increase the degree of a B-Spline. This preserves the shape and increases the amount of poles. After using it, use the "Restore Internal Aligment geometry" tool to show the new poles.
jean.thil
Posts: 209
Joined: Tue Jul 28, 2015 7:28 am

Re: Sketcher: Bezier curves

Post by jean.thil »

Many thanks. When did it go to master ? I thought I had build the latest version this morning and conversion was not here yet ?!
I think I have found a bug.
Try to project the nurbs in "sketch" in "sketch001".
Attachments
test_nurbs_crash.fcstd
(4.68 KiB) Downloaded 36 times
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Bezier curves

Post by abdullah »

jean.thil wrote:Many thanks. When did it go to master ? I thought I had build the latest version this morning and conversion was not here yet ?!
Probably just after you built this morning... ;) Werner merged it today.
jean.thil wrote:I think I have found a bug.
Try to project the nurbs in "sketch" in "sketch001".
I do not get a crash.

Sketch001 is orthogonal to Sketch. So I can just see a line after projection:
projected_bspline.png
projected_bspline.png (6.26 KiB) Viewed 1743 times
If you manage to make it crash, let me know how.

I did find a bug though. External geometry bsplines are not recognized in the Elements Widget, and are just marked as "other". Something to fix in the next deliverable.
jean.thil
Posts: 209
Joined: Tue Jul 28, 2015 7:28 am

Re: Sketcher: Bezier curves

Post by jean.thil »

Edit "sketch001". Push the "create edge link to external geometry" (I think this is the correct name in English). Click on the nurbs.

Code: Select all

FreeCAD: /home/alain/Documents/build_FreeCAD/freecad/FreeCAD/src/Mod/Sketcher/App/planegcs/GCS.cpp :3674 : int GCS::System::diagnose(GCS::Algorithm):  l'assertion « R(i,i) != 0 » a échoué.
It crashes also if I close the nurbs, extrude the area and try to link to the edge of the extruction.
Post Reply