onekk wrote: ↑Wed Aug 17, 2022 5:26 pm
Trying to solve this problem, using scripting:
https://forum.freecadweb.org/viewtopic. ... 92#p618192
I've put together the code linked below.
I've inserted some knots, as it seems that the insertion is possible using already available methods insertKnot
I don't understand what you're trying the achieve by inserting knots ?
onekk wrote: ↑Wed Aug 17, 2022 5:26 pm
I know it is rough but I wonder if there is a method to equally spacing points to avoid the bend of the curve.
What points ? The points on curve corresponding to the knots ?
No. A knot is just a parameter in the parametric space of the curve.
A parameter has a corresponding 3D point image on the curve (Curve.value(u))
And a 3D point on the curve has a corresponding parameter in the parameter range (Curve.parameter(point))
You can get equally spaced points on curve with :
Code: Select all
pts = curve.discretize(number_of_points)
And get back the corresponding parameters with:
Code: Select all
params = [curve.parameter(p) for p in pts]
onekk wrote: ↑Wed Aug 17, 2022 5:26 pm
What happens to poles?
When you insert a knot ? A new set of poles is computed.
onekk wrote: ↑Wed Aug 17, 2022 5:26 pm
Probably I'm not guessing something correct as I can't get to work the method removeKnot
Inserting a knot is always possible.
Removing a knot usually need to approximate the curve.
But I have experienced that removeKnot often fails, even with very high tolerance values. I don't know why.