Java Utililty Methods Rectangle Rotate

List of utility methods to do Rectangle Rotate

Description

The list of methods to do Rectangle Rotate are organized into topic(s).

Method

Rectangle2DrotateRectangleOnEllipse(Rectangle2D rect, Point2D center, double angle, double a, double b)
rotate Rectangle On Ellipse
double ellipseScale = b > 0 ? a / b : 0;
AffineTransform trans = AffineTransform.getRotateInstance(-angle, rect.getX() + center.getX(),
        (rect.getY() + center.getY()) * ellipseScale);
trans.scale(1.0, ellipseScale > 0 ? 1.0 / ellipseScale : 0);
Point2D upperLeft = trans.transform(new Point2D.Double(rect.getMinX(), rect.getMinY() * ellipseScale),
        null);
Point2D upperRight = trans.transform(new Point2D.Double(rect.getMaxX(), rect.getMinY() * ellipseScale),
        null);
...
Rectangle2DrotateRoundMiddlePoint(Rectangle2D rectangle)
rotate Round Middle Point
Rectangle2D rec = new Rectangle2D.Double();
rec.setRect(rectangle); 
double x = (rec.getWidth() / 2);
double y = (rec.getHeight() / 2);
rec = grow(rec, new Point2D.Double(-x, -y));
rec = grow(rec, new Point2D.Double(y, x));
return rec;