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

error in BSpline #75

Open
morder opened this issue Oct 19, 2023 · 0 comments
Open

error in BSpline #75

morder opened this issue Oct 19, 2023 · 0 comments

Comments

@morder
Copy link

morder commented Oct 19, 2023

sometimes derivativeBSpline function returns wrong values
the right code is

int n = myX.length;
double[] newControlPointsX = new double[n - 1];
double[] newControlPointsY = new double[n - 1];

for (int i = 0; i < n - 1; i++) {
    newControlPointsX[i] = degree * (myX[i + 1] - myX[i]) / (knots[i + degree + 1] - knots[i + 1]);
    newControlPointsY[i] = degree * (myY[i + 1] - myY[i]) / (knots[i + degree + 1] - knots[i + 1]);
}

double[] newKnots = new double[knots.length - 2];
System.arraycopy(knots, 1, newKnots, 0, newKnots.length);

return new BSpline(newControlPointsX, newControlPointsY, newKnots);
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

1 participant