Approximating closed BSpline

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
jfc4120
Posts: 448
Joined: Sat Jul 02, 2022 11:16 pm

Re: Approximating closed BSpline

Post by jfc4120 »

@onekk Okay I read the help, but my question is mainly:

In the shape in question a fairly smooth curve can be achieved without the approximation routine. All I did was make it parallel to a plane and used the regular in-built b-spline routine.

If having to move any points to achieve smoothness:

Code: Select all

movePoint(U, P, Index1, Index2)
Then why use it?

Where is such a routine used in real World. And granted analytic geometry is my highest math I had. But that was years ago, 1981. I don't even remember half of it.
edwilliams16
Veteran
Posts: 3109
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Approximating closed BSpline

Post by edwilliams16 »

onekk wrote: Sat Mar 18, 2023 9:12 am
I think not more magics, set degree to 2 so not too much ondulations.
Using quadratic BSplines will help in that regard, but at the price of discontinuity of curvature - so I didn't try anything less than DegMin = 3.
The problem is isolated at the join point of the closed curve, anyway. There doesn't seem to be a closed = True option I was looking for.

Thanks.

Ed
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Approximating closed BSpline

Post by onekk »

edwilliams16 wrote: Sat Mar 18, 2023 5:47 pm ...
Agreed, sorry for the noise, even for the following noise too. :lol:

Only to make some xfocus", following OCCT terminology, closed is not periodic?

In the past Chris_G probably has tried to explain some of the difference between BSpline terminology used by FreeCAD/OCCT and the usual explanation around, sadly in the source of OCCT is cited a publication saying that is following this convention (as usual if my memory is not too broken) but probably it is an old printed book.

Sadly now I'm not at computer, but after some experiments even with degree 3 it will not worsen a lot with second form in my post, tuning the algorithm as the little extract from the help() result seems to show.

I'm interested in this sort of thing too, so I've made some experiments by trial and errors, so a better knowledge of the three parameters will be interesting to know.

I wonder if in OCCT sources or blogs or forum there is some focus on these things, I will try to make some research asap I've a computer available.

Kind Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Approximating closed BSpline

Post by onekk »

jfc4120 wrote: Sat Mar 18, 2023 4:35 pm ...
There were some old posts around, and probably even some links to OCCT forum or blogs.

Sadly my memory is not helping, so I can't answer now, but as I've told in my answer to edwilliams16 I won't stop to search informations so stay tuned, a better knowledge will benefit more users.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Approximating closed BSpline

Post by onekk »

Edit from some posts around it seems that to close a curve:

- first and last Poles (control points) a
must be equal.
- first and last Knots must be equal.

https://pages.mtu.edu/~shene/COURSES/cs ... losed.html


But some other notes in OCCT sources say that Multiplicities must be equal to the curve degree to make Poles and Knots be the same.

https://github.com/Open-Cascade-SAS/OCC ... eCurve.hxx

Si probably the point is here, my memory tells me that this is a thing someone as told me some time ago, but my memory is broken.

Sadly I've done research using my smartphone so I could be wrong.

Hope it helps.

Regards

Carlo D.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
edwilliams16
Veteran
Posts: 3109
Joined: Thu Sep 24, 2020 10:31 pm
Location: Hawaii
Contact:

Re: Approximating closed BSpline

Post by edwilliams16 »

@onekk Thanks for the references.

The only marked up part of my used copy of The Nurbs Book by Piegl and Tiller is the section talking about clamped vs. unclamped, periodic vs. non-periodic, uniform vs. non-uniform, rational vs. non-rational, closed vs. open! He says some of the nomenclature has changed with time, adding to the confusion. I haven't got it totally sorted out yet. I'm certainly not clear of what FreeCAD uses and when.

It seems approximate() was a dead end - interpolate() is more appropriate for my needs, anyway.
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Approximating closed BSpline

Post by onekk »

edwilliams16 wrote: Sun Mar 19, 2023 1:51 am @onekk Thanks for the references.
...
After some research and despite being on mobile I've found something:

viewtopic.php?p=580413#p580413

but also:

viewtopic.php?p=7874#p7874

http://forum.freecadweb.org/viewtopic.p ... =10#p37515


Sadly I don't read german @chrisb please could you help with german post?

Hope it helps

Regards
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
Post Reply