@Test public void baseFunctions1() { Point3D[] points = new Point3D[]{}; double[] knots = new double[]{0, 0, 0, 1, 2, 3, 4, 4, 5, 5}; double[] w = new double[]{}; NURBS n = new NURBS(points, knots, w, 2); double[] bf = n.getBasicFunctions(4, 2.5); assertEquals(3, bf.length); assertEquals(1.0 / 8.0, bf[0], DELTA); assertEquals(6.0 / 8.0, bf[1], DELTA); assertEquals(1.0 / 8.0, bf[2], DELTA); }
public double[] getBasicFunctions(int i, double u) { double[] n = new double[degree + 1]; n[0] = 1.0; double[] left = new double[degree + 1]; double[] right = new double[degree + 1]; for (int j = 1; j <= degree; j++) { left[j] = u - this.knots[(i + 1) - j]; right[j] = this.knots[i + j] - u; double saved = 0.0; for (int r = 0; r < j; r++) { double t = n[r] / (right[r + 1] + left[j - r]); n[r] = saved + (right[r + 1] * t); saved = left[j - r] * t; } n[j] = saved; } return n; }
NURBS { public double[] getBasicFunctions(int i, double u) { double[] n = new double[degree + 1]; n[0] = 1.0; double[] left = new double[degree + 1]; double[] right = new double[degree + 1]; for (int j = 1; j <= degree; j++) { left[j] = u - this.knots[(i + 1) - j]; right[j] = this.knots[i + j] - u; double saved = 0.0; for (int r = 0; r < j; r++) { double t = n[r] / (right[r + 1] + left[j - r]); n[r] = saved + (right[r + 1] * t); saved = left[j - r] * t; } n[j] = saved; } return n; } }
NURBS { public double[] getBasicFunctions(int i, double u) { double[] n = new double[degree + 1]; n[0] = 1.0; double[] left = new double[degree + 1]; double[] right = new double[degree + 1]; for (int j = 1; j <= degree; j++) { left[j] = u - this.knots[(i + 1) - j]; right[j] = this.knots[i + j] - u; double saved = 0.0; for (int r = 0; r < j; r++) { double t = n[r] / (right[r + 1] + left[j - r]); n[r] = saved + (right[r + 1] * t); saved = left[j - r] * t; } n[j] = saved; } return n; } NURBS(Point3D[] controlPoints, double[] knots, double[] weights,
        int degree); }
NURBS { public double[] getBasicFunctions(int i, double u) { double[] n = new double[degree + 1]; n[0] = 1.0; double[] left = new double[degree + 1]; double[] right = new double[degree + 1]; for (int j = 1; j <= degree; j++) { left[j] = u - this.knots[(i + 1) - j]; right[j] = this.knots[i + j] - u; double saved = 0.0; for (int r = 0; r < j; r++) { double t = n[r] / (right[r + 1] + left[j - r]); n[r] = saved + (right[r + 1] * t); saved = left[j - r] * t; } n[j] = saved; } return n; } NURBS(Point3D[] controlPoints, double[] knots, double[] weights,
        int degree); double[] getBasicFunctions(int i, double u); Point3D getPointAt(int i, double u); Point3D getPointAt(double u); int findSpawnIndex(double u); Point3D[] getControlPoints(); void setControlPoints(Point3D[] controlPoints); double[] getKnots(); void setKnots(double[] knots); double[] getWeights(); void setWeights(double[] weights); int getDegree(); void setDegree(int degree); boolean isClosed(); void setClosed(boolean closed); }
NURBS { public double[] getBasicFunctions(int i, double u) { double[] n = new double[degree + 1]; n[0] = 1.0; double[] left = new double[degree + 1]; double[] right = new double[degree + 1]; for (int j = 1; j <= degree; j++) { left[j] = u - this.knots[(i + 1) - j]; right[j] = this.knots[i + j] - u; double saved = 0.0; for (int r = 0; r < j; r++) { double t = n[r] / (right[r + 1] + left[j - r]); n[r] = saved + (right[r + 1] * t); saved = left[j - r] * t; } n[j] = saved; } return n; } NURBS(Point3D[] controlPoints, double[] knots, double[] weights,
        int degree); double[] getBasicFunctions(int i, double u); Point3D getPointAt(int i, double u); Point3D getPointAt(double u); int findSpawnIndex(double u); Point3D[] getControlPoints(); void setControlPoints(Point3D[] controlPoints); double[] getKnots(); void setKnots(double[] knots); double[] getWeights(); void setWeights(double[] weights); int getDegree(); void setDegree(int degree); boolean isClosed(); void setClosed(boolean closed);  }