Silk: a NURBS workbench
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Silk: a NURBS workbench
Hi Edward,
Nice to see that you are still working on Silk.
Are you using the basis functions for your blending algorithm ?
I am experimenting with the same kind of stuff currently.
So, here are a couple of links that may interest you :
- https://github.com/sintefmath/Splipy is a python library for nurbs by sintef
- I remember that you asked if there was basis functions in FC source code. There is, in C++, but without python binding.
- I am working on adding G3 and G4 continuity to my blendcurve tool. I think I am almost there :
https://github.com/tomate44/CurvesWB/bl ... neBasis.py
Nice to see that you are still working on Silk.
Are you using the basis functions for your blending algorithm ?
I am experimenting with the same kind of stuff currently.
So, here are a couple of links that may interest you :
- https://github.com/sintefmath/Splipy is a python library for nurbs by sintef
- I remember that you asked if there was basis functions in FC source code. There is, in C++, but without python binding.
- I am working on adding G3 and G4 continuity to my blendcurve tool. I think I am almost there :
https://github.com/tomate44/CurvesWB/bl ... neBasis.py
Re: Silk: a NURBS workbench
very nice
For my method, i'm not using the basis functions directly for the change of curvature matching. Just sliding what i call the "inner scales" of a 6 point cubic. The inner scales are the degrees of freedom that is left when i match curvature using my basis function derived rule. I don't intend to go above G3 matching at the seams for a while, so i'm just using a numerical method.
because i use a 6 point cubic, G3 is not even guaranteed inside the curve, only at the outer points of the blend. I'm intentionally limiting the degree and number of poles so that will know how to build a grid out of the result. Even at these low degrees and pole count, these models already slow down my computer a lot.
All i'm using this for is blending sections of bezier, so i expect this to be 'just barely good enough' for most of my use cases.
i see you have max degree 9 set. do you know what degree curve was actually returned in the picture below (i mean your picture of your blend)?
It's nowhere near as smooth as yours, that's for sure. do you have a method in mind to apply your blends to arbitrary surface topology like shown below?
For my method, i'm not using the basis functions directly for the change of curvature matching. Just sliding what i call the "inner scales" of a 6 point cubic. The inner scales are the degrees of freedom that is left when i match curvature using my basis function derived rule. I don't intend to go above G3 matching at the seams for a while, so i'm just using a numerical method.
because i use a 6 point cubic, G3 is not even guaranteed inside the curve, only at the outer points of the blend. I'm intentionally limiting the degree and number of poles so that will know how to build a grid out of the result. Even at these low degrees and pole count, these models already slow down my computer a lot.
All i'm using this for is blending sections of bezier, so i expect this to be 'just barely good enough' for most of my use cases.
i see you have max degree 9 set. do you know what degree curve was actually returned in the picture below (i mean your picture of your blend)?
It's nowhere near as smooth as yours, that's for sure. do you have a method in mind to apply your blends to arbitrary surface topology like shown below?
Last edited by emills2 on Sun Mar 25, 2018 12:27 am, edited 2 times in total.
Re: Silk: a NURBS workbench
there it is!
Code: Select all
void BSplineBasis::DerivativesOfBasisFunction
The good thing is that this derivative of curvature matching function is very modular and easy to swap out. for the time being, the G3 matching is instantaneous compared to generating surfaces.
Re: Silk: a NURBS workbench
actually, i oversimplified. even if i have a nice exact third derivative of the the basis function, i would still need to differentiate the curvature function itself with respect to arclength. and i don't know how to do that so the numerical method will have to do for now!
Re: Silk: a NURBS workbench
since long term i want to do that as well, i want to clarify what the limits of my new tool are.
in these first two pictures, the right side poly has all segments in a straight line. the right endpoint has 0 curvature. 0 derivative of curvature, 0 second derivative of curvature, 0 third...
My 6P cubic can match the curvature on each side, but only one of the two derivatives of curvature(with consistency). In this case, the object always chooses the curved side to match change of curvature. The 0 derivatives side just has the curvature tapering to 0, with no further effort. the object handles inflection points on the curved portions, so for my current need, it's robust.
as long as there are no straight lines, the object can match derivatives of curvature (combs are tangent) on both curves, including when input curves both have inflection points. the 6P curve itself is not perfectly G3 between the endpoints, because cubic curves cannot guarantee G3. Nevertheless, cubic curves and surfaces are generally considered appropriate for many design jobs, and they already push my computer to its limit. At the surface precision i use in order to inspect the seams, models can take minutes to update.
Re: Silk: a NURBS workbench
G4 continuity at a curve end implies 5 control points at that end.
So G4 at both ends gives 10 control points -> degree 9
Leaving Maxdegree at 9, I am sure that the blend curve will be a bezier curve, but I wanted to be able to lower the degree and insert knots to see if the tweaking of the blend curve was easier, more intuitive.
Not yet. That is an interesting problem. But looking back at my past learning curve, it will take a couple more years before I can give a try at that kind of stuff
If don't look for high performance, I have the needed functions here : bsplineBasis.pyemills2 wrote: ↑Sun Mar 25, 2018 12:11 am basically the same as derbasisfuns. if i could get my hands on that, i could generate a formula for my change of curvature instead of approximating it by taking shorter and shorter segments of a curve. As it happens, i am up to my neck in division by zero problems, because segmentation creates degenerate sets of poles before the algorithm converges.
There is an example at the end of the file (with slipy example too).
BTW, slipy has probably much better performance, since the basis functions are coded in C.
G3 / G3 with only 6 points ? While 8 should be needed ? That's a nice result !
Re: Silk: a NURBS workbench
you don't need actually need 8 points, just 4 points starting from each end. They can be the same points
the fact that the same control point controls the curvature of one end along one axis while controlling the derivative of curvature of the other end along an orthogonal axis does give headaches. right now it handles curves well, and straight lines well, but it can still freak out when the curve is 'almost flat'.
I really like the result you showed earlier. my problem with that strategy is that i have no idea what to do with all those extra points. Which is the general NURBS problem: every time you want just one more degree of freedom, you have accept 2...or 3, and then figure out what the hell you're going to do with them.
Re: Silk: a NURBS workbench
The beauty and the hell of Nurbs ... I love them !emills2 wrote: ↑Sun Mar 25, 2018 6:53 pm I really like the result you showed earlier. my problem with that strategy is that i have no idea what to do with all those extra points. Which is the general NURBS problem: every time you want just one more degree of freedom, you have accept 2...or 3, and then figure out what the hell you're going to do with them.
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Silk: a NURBS workbench
+1
This is where the human spirit comes in place: How to simplify a surface without loss of beauty. May be we will have sometime in future other computational concepts than interpolation and approximation to get models from datasets. at the moment we only can play with our experience to find the patterns of simplicity. This is for me the miracle of Design in CAD.
This is where the human spirit comes in place: How to simplify a surface without loss of beauty. May be we will have sometime in future other computational concepts than interpolation and approximation to get models from datasets. at the moment we only can play with our experience to find the patterns of simplicity. This is for me the miracle of Design in CAD.
-
- Posts: 656
- Joined: Tue May 19, 2015 1:11 am
Re: Silk: a NURBS workbench
I don't know much about Silk (or NURBS honestly) but I saw Chris_G mentioned a python nurbs library, so I thought I'd mention verb, an open-source cross-platform NURBS library. As I'm considering embarking on a journey to write my own CAD kernel ( I know. don't worry, I may not be actually crazy enough to try it) I've been doing some research on what existing libraries I could pull in to accomplish various discrete tasks (so that I don't have to 'reinvent the wheel' as it were). verb seems like a good candidate for me to implement NURBS, though I must admit I haven't had any time to mess around with it.