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

Clamp t between [0,1] #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bjnortier
Copy link

I have a case where a floating point precision error generates an 'out of bounds' error. This is from a user of my dxf library (https://github.com/bjnortier/dxf), which uses b-spline to interpolate DXF splines.

Using the parameters in the example I added to test/index.js, when t = 1.0, remapped t and high are:

t -120.35864538112247
high -120.3586453811225

which then generates an error. My proposal in this pull request is to move the bounds check to the beginning of the function (0 <= t <= 1.0), and then clamping the remapped t between "high" and "low".

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

Successfully merging this pull request may close these issues.

1 participant