【发布时间】:2014-05-14 02:30:11
【问题描述】:
我正在尝试将 Rectangle2D 对象旋转特定的 theta。但我不能这样做,因为 Rectangle2D 的方法 transform(AffineTransform) 是未定义的。关于如何做到这一点的任何想法?谢谢。
Rectangle2D.Double currentVehic = new Rectangle2D.Double(bottomLeft[0], bottomLeft[1],vehicWidth, vehicHeight);
// Rotate the vehicle perimeter about its center
AffineTransform rotate = new AffineTransform();
//Rectangle2D rotatedVehic = AffineTransform.getRotateInstance(theta,x,y);
rotate.setToRotation(theta, x, y);
currentVehic.transform(rotate);
return currentVehic;
【问题讨论】: