Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Evaluate spline with chordal error #227

Closed
esuig opened this issue Mar 3, 2023 · 5 comments
Closed

Evaluate spline with chordal error #227

esuig opened this issue Mar 3, 2023 · 5 comments

Comments

@esuig
Copy link

esuig commented Mar 3, 2023

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).

error

Thank you very much

@msteinbeck
Copy link
Owner

msteinbeck commented Mar 3, 2023

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.

@esuig
Copy link
Author

esuig commented Mar 7, 2023

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

@msteinbeck
Copy link
Owner

Could you solve your issue?

@esuig
Copy link
Author

esuig commented Jul 31, 2023

Hello @msteinbeck,

unfortunately I did not step into that yet, I'm still working on other things.

@msteinbeck
Copy link
Owner

Ok, I keep this issue open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants