public Point2D.Double eval(double param, Point2D.Double point) { point.x = 0; point.y = 0; int numKnots = coord.length / 2; for (int i = 0; i < numKnots; i++) { double scale = bernstein(numKnots - 1, i, param); point.x += coord[i * 2] * scale; point.y += coord[i * 2 + 1] * scale; } return point; }
public void setCoords(double sx, double sy, double[] coords, int numCoords) { coord = new double[numCoords * 2 + 2]; coord[0] = sx; coord[1] = sy; for (int i = 0; i < numCoords; i++) { coord[i * 2 + 2] = coords[i * 2]; coord[i * 2 + 3] = coords[i * 2 + 1]; } calcLength(); }
private void calcLength() { length = 0; for (int i = 2; i < coord.length; i += 2) { length += lineLength(coord[i - 2], coord[i - 1], coord[i], coord[i + 1]); } }
last.getFinalPoint(point); xform.setToTranslation(point.x, point.y); return xform; double bezLength = bez.getLength(); if (curLength < bezLength) bez.eval(param, point); break;
public Bezier(double sx, double sy, double[] coords, int numCoords) { setCoords(sx, sy, coords, numCoords); }
retVal *= choose(numKnots, knotNo);
last.getFinalPoint(point); xform.setToTranslation(point.x, point.y); return xform; double bezLength = bez.getLength(); if (curLength < bezLength) bez.eval(param, point); break;
public Bezier(double sx, double sy, double[] coords, int numCoords) { setCoords(sx, sy, coords, numCoords); }
retVal *= choose(numKnots, knotNo);
last.getFinalPoint(point); xform.setToTranslation(point.x, point.y); return xform; double bezLength = bez.getLength(); if (curLength < bezLength) bez.eval(param, point); break;
public void setCoords(double sx, double sy, double[] coords, int numCoords) { coord = new double[numCoords * 2 + 2]; coord[0] = sx; coord[1] = sy; for (int i = 0; i < numCoords; i++) { coord[i * 2 + 2] = coords[i * 2]; coord[i * 2 + 3] = coords[i * 2 + 1]; } calcLength(); }
private void calcLength() { length = 0; for (int i = 2; i < coord.length; i += 2) { length += lineLength(coord[i - 2], coord[i - 1], coord[i], coord[i + 1]); } }
public Point2D.Double eval(double param, Point2D.Double point) { point.x = 0; point.y = 0; int numKnots = coord.length / 2; for (int i = 0; i < numKnots; i++) { double scale = bernstein(numKnots - 1, i, param); point.x += coord[i * 2] * scale; point.y += coord[i * 2 + 1] * scale; } return point; }
public Bezier(double sx, double sy, double[] coords, int numCoords) { setCoords(sx, sy, coords, numCoords); }
retVal *= choose(numKnots, knotNo);
last.getFinalPoint(point); xform.setToTranslation(point.x, point.y); return xform; double bezLength = bez.getLength(); if (curLength < bezLength) bez.eval(param, point); break;