How to have rotated Ellipse shape in Java?

余生长醉 提交于 2019-12-10 19:32:53

问题


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.


回答1:


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));


来源:https://stackoverflow.com/questions/10872311/how-to-have-rotated-ellipse-shape-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!