3

How to have rotated ellipse Shape in java? I.e. so that its semi-axes are not parallel to coordinate axes?

P.S. I need not just draw this ellipse but have it in memory as a shape object.

duffymo
  • 305,152
  • 44
  • 369
  • 561
Suzan Cioc
  • 29,281
  • 63
  • 213
  • 385

1 Answers1

10

Just take an Ellipse2D object and apply an AffineTransform rotation to it, no?

AffineTransform.getRotateInstance(Math.PI / 4)
  .createTransformedShape(new Ellipse2D.Double(0, 0, 2, 1));
Louis Wasserman
  • 191,574
  • 25
  • 345
  • 413