private static final double getDerivative(final int derivative, final double t, final NFastDoubleArrayJSO values) { final int n = values.size() - 1; if (n == 0) { return 0; } if (derivative == 0) { double value = 0; for (int k = 0; k <= n; k++) { value += binomials(n, k) * Math.pow(1 - t, n - k) * Math.pow(t, k) * values.get(k); } return value; } else { final NFastDoubleArrayJSO lowers = NFastDoubleArrayJSO.make(); for (int k = 0; k < n; k++) { lowers.push(n * (values.get(k + 1) - values.get(k))); } return getDerivative(derivative - 1, t, lowers); } }
private static final NFastDoubleArrayJSO findAllRoots(final int derivative, final NFastDoubleArrayJSO values) final NFastDoubleArrayJSO root = NFastDoubleArrayJSO.make(); if (areLinear(values) || derivative == 1 && values.size() == 3) root.push(map(0, beg, end, 0, 1)); if (root.contains(r)) root.push(r);
private static final NFastDoubleArrayJSO getOrthogonalLinePoints(final Point2DArray points, Direction tailDirection, Direction headDirection, final double correction) final NFastDoubleArrayJSO buffer = NFastDoubleArrayJSO.make(); int size = buffer.size(); p1 = new Point2D(buffer.get(size - 2), buffer.get(size - 1)); direction = getDirection(buffer.get(size - 4), buffer.get(size - 3), p1.getX(), p1.getY());
public DashArray() { this(NFastDoubleArrayJSO.make()); }
@Override public boolean equals(Object other) { if ((other == null) || (false == (other instanceof DashArray))) { return false; } if (this == other) { return true; } DashArray that = ((DashArray) other); final int leng = size(); if (that.size() != leng) { return false; } NFastDoubleArrayJSO o_jso = that.getJSO(); for (int i = 0; i < leng; i++) { if (o_jso.get(i) != m_jso.get(i)) { return false; } } return true; }
public final int size() { return m_jso.size(); }
NFastDoubleArrayJSO tval = NFastDoubleArrayJSO.make(); tval.push(0.0); tval.push(1.0); size = root.size(); final double t = root.get(i); tval.push(t); size = root.size(); final double t = root.get(i); tval.push(t); size = root.size(); final double t = root.get(i); tval.push(t); size = root.size(); final double t = root.get(i); tval.push(t);
public final static NFastDoubleArrayJSO convertEndpointToCenterParameterization(final double x1, final double y1, final double x2, final double y2, final double fa, final double fs, double rx, double ry, final double pv) { final NFastDoubleArrayJSO points = NFastDoubleArrayJSO.make(); convertEndpointToCenterParameterization(points, x1, y1, x2, y2, fa, fs, rx, ry, pv); return points; }
private static final void addPoint(final NFastDoubleArrayJSO buffer, final double x, final double y) { buffer.push(x, y); }
m_box.add(oldx = p.get(0), oldy = p.get(1)); break; case PathPartEntryJSO.MOVETO_ABSOLUTE: m_box.add(oldx = p.get(0), oldy = p.get(1)); break; case PathPartEntryJSO.BEZIER_CURVETO_ABSOLUTE: m_box.add(Curves.getBoundingBox(new Point2DArray(new Point2D(oldx, oldy), new Point2D(p.get(0), p.get(1)), new Point2D(p.get(2), p.get(3)), new Point2D(oldx = p.get(4), oldy = p.get(5))))); break; case PathPartEntryJSO.QUADRATIC_CURVETO_ABSOLUTE: m_box.add(Curves.getBoundingBox(new Point2DArray(new Point2D(oldx, oldy), new Point2D(p.get(0), p.get(1)), new Point2D(oldx = p.get(2), oldy = p.get(3))))); break; case PathPartEntryJSO.ARCTO_ABSOLUTE: double cx = p.get(0); double cy = p.get(1); double rx = p.get(2); double ry = p.get(3); m_box.addX(cx + rx); m_box.addX(cx - rx); m_box.addY(cy + ry); m_box.addY(cy - ry); oldx = p.get(8); oldy = p.get(9); break;
final NFastDoubleArrayJSO source = NFastDoubleArrayJSO.make(); source.push(Double.parseDouble(pts[i])); while (source.size() > 0) final NFastDoubleArrayJSO points = NFastDoubleArrayJSO.make(); cpx += source.shift(); cpy += source.shift(); points.push(cpx); points.push(cpy); cpx = source.shift(); cpy = source.shift(); points.push(cpx); points.push(cpy); final double dx = source.shift(); final double dy = source.shift(); cpx = prev.getPoints().get(0) + dx;
public final PathPartList M(final double x, final double y) { m_mov = true; push(PathPartEntryJSO.make(PathPartEntryJSO.MOVETO_ABSOLUTE, NFastDoubleArrayJSO.make(m_cpx = x, m_cpy = y))); return this; }
public final DashArray push(double dash) { if (dash < 0) { dash = Math.abs(dash); } m_jso.push(dash); return this; }