Closed esuig closed 8 months ago
Hi @esuig,
you probably want to use the ChordLengths
class for this. Given a spline, you can create an instance of ChordLengths
with:
BSpline spline = ...
ChordLenghts cls = spline.chordLengths(); // default is 200
cls
now allows you to map between arc lengths and knots. The precision of the mapping depends on the number of knots to be evaluated when setting the ChordLenghts
instance (the argument passed to the chordLengths()
method). 200 is the default. You can set this to 500 if you need a very very very very precise mapping. Once you obtained cls
, use the method arcLength
to obtain the overall length of the spline and lengthToKnot
or tToKnot
(where t
means relative proportion of arcLength
) to map between arc lengths and knots. The knots, in turn, can be evaluated with eval
or evalAll
. This approach also allows you to create a polyline with equidistant points with respect to the spline.
Hello @msteinbeck,
thank you very much for your exaplanation. I'll try to implement what you're suggesting and I'll let you know what happens. It will take a while, since I need to conclude another project first. If you prefer to close the issue I'll reopen to post the results
Could you solve your issue?
Hello @msteinbeck,
unfortunately I did not step into that yet, I'm still working on other things.
Ok, I keep this issue open.
Hi, as I understand the proposed way to evaluate as polyline will sample the points at even distances along the spline. However, if you want to limit the maximum error/deviation/chordal distance from spline to sampled polyline, you don't really know how often you need to sample the points. And the required sampling distances may differ depending on the shape of the spline, e. g. straight segments need to be sampled less often.
Hi, as I understand the proposed way to evaluate as polyline will sample the points at even distances along the spline. However, if you want to limit the maximum error/deviation/chordal distance from spline to sampled polyline, you don't really know how often you need to sample the points. And the required sampling distances may differ depending on the shape of the spline, e. g. straight segments need to be sampled less often.
Exactly.
Thanks, so I understand that this library does not have routines to perform what this issue asks for? Do you have plans to implement it or maybe know some resources where it is explained how to achieve this?
Hello,
this is not an issue, but a request for info.
I have a tinyspline::BSpline in 3 dimension. Is it possible to evaluate it obtaining points that can generate a polyline that will have a given maximum chordal error respect to the original spline? the image below graphically explains what I mean, hope it is clear (the blue one is the original spline, the red one the polyline obtained connecting all the points obtained from the spline).
Thank you very much