Java Graphics Rotate rotateByAngle(final Point2D pos, final Point2D center, final double angle)

Here you can find the source of rotateByAngle(final Point2D pos, final Point2D center, final double angle)

Description

Rotates a point a given angle around the center.

License

Open Source License

Parameter

Parameter Description
pos The point to rotate.
center The center.
angle The angle.

Return

The rotated point.

Declaration

public static Point2D rotateByAngle(final Point2D pos, final Point2D center, final double angle) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.awt.geom.AffineTransform;

import java.awt.geom.Point2D;

public class Main {
    /**//from   w  w w  .  j  a va2 s . c  om
     * Rotates a point a given angle around the center.
     * 
     * @param pos The point to rotate.
     * @param center The center.
     * @param angle The angle.
     * @return The rotated point.
     */
    public static Point2D rotateByAngle(final Point2D pos, final Point2D center, final double angle) {
        final AffineTransform at = AffineTransform.getRotateInstance(angle, center.getX(), center.getY());
        return at.transform(pos, null);
    }
}

Related

  1. rotate(Point2D.Double point, double dAngle)
  2. rotate(Shape shape, float angle, float x, float y)
  3. rotate_point(double rx, double ry, double angle, double cx, double cy)
  4. rotateArea(Area a, double rotation, Point2D rotateAround)
  5. rotateBy(Vector points, double theta, Vector newPoints)
  6. rotateClockwise(Path source, Path target)
  7. rotateCoor(float x, float y, float theta)
  8. rotateCoorAroundPoint(float x, float y, float xctr, float yctr, float theta)
  9. rotateHue(Color color, float fraction)