public int currentSegment(double[] coords) { if (isDone()) { // awt.4B=Iterator out of bounds throw new java.util.NoSuchElementException("Iterator out of bounds"); //$NON-NLS-1$ } int type; int count; if (index == 0) { type = PathIteratorConstants.SEG_MOVETO; coords[0] = c.getX1(); coords[1] = c.getY1(); count = 1; } else { type = PathIteratorConstants.SEG_QUADTO; coords[0] = c.getCtrlX(); coords[1] = c.getCtrlY(); coords[2] = c.getX2(); coords[3] = c.getY2(); count = 2; } if (t != null) { t.transform(coords, 0, coords, 0, count); } return(type); }
public void setCurve(QuadCurve2D curve) { setCurve( curve.getX1(), curve.getY1(), curve.getCtrlX(), curve.getCtrlY(), curve.getX2(), curve.getY2()); }
public static void subdivide(QuadCurve2D src, QuadCurve2D left, QuadCurve2D right) { double x1 = src.getX1(); double y1 = src.getY1(); double cx = src.getCtrlX(); double cy = src.getCtrlY(); double x2 = src.getX2(); double y2 = src.getY2(); double cx1 = (x1 + cx) / 2.0; double cy1 = (y1 + cy) / 2.0; double cx2 = (x2 + cx) / 2.0; double cy2 = (y2 + cy) / 2.0; cx = (cx1 + cx2) / 2.0; cy = (cy1 + cy2) / 2.0; if (left != null) { left.setCurve(x1, y1, cx1, cy1, cx, cy); } if (right != null) { right.setCurve(cx, cy, cx2, cy2, x2, y2); } }