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!
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Sketcher: Bezier curves

Post by microelly2 »

abdullah wrote:
microelly2 wrote:With nurbs "nearly all" usual surfaces can be described. For any face there is already a method toNurbs, so any face can be transformed to a nurbs and then there can done modifications when the bspline data.
Then... couldn't I make a tool to convert any geometric element in a sketcher to its nurbs counterpart? Wouldn't that be nice?
I believe this is possible.
the structures handled by the sketcher at the moment can be converted to nurbs.
Still the sketcher does not know sin/tan log/exp gamma ...
but for these function discretize and interpolate will deliver good models too.


microelly2 wrote:One powerful property is that nurbs support perspective projections.
That means that these transformations only must be applied on the poles, so for examples mapping texts to faces is no more a problem.
models can be build on planar faces and then mapped to spheres, cones etc. by transformations of the poles and the weights.
We do not need to understand all the papers on BSplines of the last 15 years but having a couple of example will help to design common structures.
Thanks! Having a couple of examples triggers this community brainstorming capacity exponentially... :)
The last half of a year I tested the usability of nurbs for mass data
I have not documented to much but my video channel is full of examples.
https://www.youtube.com/channel/UCCib1J ... kakjRclz2w

Your sketcher extension is a very big step forward to increase usebility of 2D BSplines. Going to 3D with Loft/Sweep is already implemented.
But there are other special opportunities too.
I made a needle class based on two bsplines and a hood class.

Postprocessing Point clouds and reduction to "simpler" nurbs is an other idea.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Bezier curves

Post by abdullah »

NormandC wrote: Oh boy, I just learned something new. I never noticed we could filter the objects in the Elements widget. :oops:

Thanks for pointing it out to me Abdullah!
You are welcome. You can round-robin iterate between filters by pressing "z"...
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Bezier curves

Post by abdullah »

microelly2 wrote:The last half of a year I tested the usability of nurbs for mass data
I have not documented to much but my video channel is full of examples.
https://www.youtube.com/channel/UCCib1J ... kakjRclz2w
A very interesting source indeed... Lots of different applications... still I really liked the banana generating tool and the banana (I can understand somebody wanting to mill that banana out in aluminium :) )
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Sketcher: Bezier curves

Post by microelly2 »

abdullah wrote:I can understand somebody wanting to mill that banana out in aluminium :)
Why create a banana on aluminum,

I'd rather extrude them with a nozzle by tilting and rotating the nozzle or/and change the pressure

and describe it all as Nurbs

and use Nut/Ice/whipped cream - in case of waste you can eat it and improve the nurbs or write a feature request :lol:
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Sketcher: Bezier curves

Post by wmayer »

NormandC wrote:
That paper is way too technical for a math-impaired guy like me. :?
At the moment it's not possible to model a perfect circle with a single spline because you have to set a custom knot vector. But you can model a perfect quarter of a circle and then simply put together four quarters. See the attached project.

Right to the perfect circle there is a single spline with the same weights but with the standard knot vector and you can see it's clearly not a circle.
Attachments
circle.fcstd
(9.36 KiB) Downloaded 39 times
wmayer
Founder
Posts: 20324
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Sketcher: Bezier curves

Post by wmayer »

Note: Werner, could you please take a look at the last commit of this branch? I have zero confidence in myself when it comes to Coin. Let me know your impressions.
Your code is good but with one exception: you change the scene graph structure for each call of draw() which is not only slow but can also cause hazardous behaviour in cases when draw() is called during the traversal of the graph. You better keep the scene graph structure fix and only change the fields of the Inventor nodes when modifying the geometry.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Sketcher: Bezier curves

Post by NormandC »

wmayer wrote:But you can model a perfect quarter of a circle and then simply put together four quarters. See the attached project.
Cool, thanks for the tip!
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Bezier curves

Post by abdullah »

Latest progress has been made into:
- Improving rendering of Information layer so that scenography is only rebuild when nodes actually change
- Implementing information layer show/hide functionality per type of information (i.e. switch off control polygons)
- Implementing Chris_G's comb

I would have a doubt about what to do with the comb for periodic curves (reduce the curvature amplification factor?). This is what happens:
combs.png
combs.png (38.25 KiB) Viewed 1990 times
In the meanwhile I have asked for some icons:
https://forum.freecadweb.org/viewtopic. ... 6&start=30

agryson was nice enough to provide me with one. These icons are to implement toggle type hide/show. Initially I asked for two to switch the icon as when creating construction geometry. But I think he is right that this would be much better if a toggle type button is implemented. I have to take a look into the macros we use for commands in the sketcher, and probably implement new macros or modify the existing ones...
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: Sketcher: Bezier curves

Post by microelly2 »

abdullah wrote:
I would have a doubt about what to do with the comb for periodic curves (reduce the curvature amplification factor?). This is what happens:
what if you take the opposite direction of the curvature vector?
Then it is mainly outside the closed curve and only in concave regions it points to the inner area.

the other idea to scale it is nice too but which factor to use.
abdullah
Veteran
Posts: 4935
Joined: Sun May 04, 2014 3:16 pm
Contact:

Re: Sketcher: Bezier curves

Post by abdullah »

microelly2 wrote:what if you take the opposite direction of the curvature vector?
Then it is mainly outside the closed curve and only in concave regions it points to the inner area.
I do not know if that would be useful for people using this. What do you think, people usually using this?
microelly2 wrote:the other idea to scale it is nice too but which factor to use.
As I had calculated the center of mass for putting the degree, I have thought of reusing it. This is normalizing the max curvature to 0.5 * max(distance(centerofmass,point at edge of the curve)):
combs_centerofmass.png
combs_centerofmass.png (37.35 KiB) Viewed 1953 times
Edit: One open bspline, one close non-periodic bspline, one periodic bspline.
Post Reply