Esempio n. 1
0
  /**
   * Transforms this circle by an affine transform. If the transformed shape is a circle (ellipse
   * with equal axis lengths), returns an instance of Circle2D. The resulting ellipse is direct if
   * this ellipse and the transform are either both direct or both indirect.
   */
  public EllipseShape2D transform(AffineTransform2D trans) {
    // When the transform is not a similarity, should switch to EllipseArc
    // computation
    if (!AffineTransform2D.isSimilarity(trans)) {
      return this.asEllipse().transform(trans);
    }

    // If transform is a similarity, the result is a circle
    Point2D center = this.center().transform(trans);
    Point2D p1 = this.firstPoint().transform(trans);

    boolean direct = !this.direct ^ trans.isDirect();
    Circle2D result = new Circle2D(center, center.distance(p1), direct);
    return result;
  }