/** * Constructs a new subpath starting at the given point. */ public Subpath(Point2D startPoint) { this((float) startPoint.getX(), (float) startPoint.getY()); }
/** * Appends a cubic Bezier curve to the current path. The curve shall extend from * the current point to the point <CODE>(x3, y3)</CODE> with the note that the current * point represents two control points. */ public void curveTo(final float x2, final float y2, final float x3, final float y3) { if (currentPoint == null) { throw new RuntimeException(START_PATH_ERR_MSG); } curveTo((float) currentPoint.getX(), (float) currentPoint.getY(), x2, y2, x3, y3); }
/** * Sets the start point of the subpath. * @param startPoint */ public void setStartPoint(Point2D startPoint) { setStartPoint((float) startPoint.getX(), (float) startPoint.getY()); }
public boolean contains(Point2D point) { return contains(point.getX(), point.getY()); }
public boolean contains(Point2D p) { return contains(p.getX(), p.getY()); }
public int outcode(Point2D p) { return outcode(p.getX(), p.getY()); }
public Point2D transform(Point2D src, Point2D dst) { if (dst == null) { if (src instanceof Point2D.Double) { dst = new Point2D.Double(); } else { dst = new Point2D.Float(); } } double x = src.getX(); double y = src.getY(); dst.setLocation(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12); return dst; }
public Point2D deltaTransform(Point2D src, Point2D dst) { if (dst == null) { if (src instanceof Point2D.Double) { dst = new Point2D.Double(); } else { dst = new Point2D.Float(); } } double x = src.getX(); double y = src.getY(); dst.setLocation(x * m00 + y * m01, x * m10 + y * m11); return dst; }
@Override public int hashCode() { HashCode hash = new HashCode(); hash.append(getX()); hash.append(getY()); return hash.hashCode(); }
/** * Closes the current subpath. */ public void closeSubpath() { Subpath lastSubpath = getLastSubpath(); lastSubpath.setClosed(true); Point2D startPoint = lastSubpath.getStartPoint(); moveTo((float) startPoint.getX(), (float) startPoint.getY()); }
@Override public int hashCode() { HashCode hash = new HashCode(); hash.append(getX()); hash.append(getY()); return hash.hashCode(); }
public double ptLineDist(Point2D p) { return ptLineDist(getX1(), getY1(), getX2(), getY2(), p.getX(), p.getY()); }