Java Graphics Rotate rotate(Point toRotate, float tetta)

Here you can find the source of rotate(Point toRotate, float tetta)

Description

rotate

License

Apache License

Declaration

public static Point rotate(Point toRotate, float tetta) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.awt.Point;

public class Main {
    public static Point rotate(Point toRotate, float tetta) {
        float sin = (float) Math.sin(tetta);
        float cos = (float) Math.cos(tetta);

        int x = (int) (toRotate.x * cos - toRotate.y * sin);
        int y = (int) (toRotate.x * sin + toRotate.y * cos);

        return new Point(x, y);
    }//from w  w  w .ja va2  s  . co  m
}

Related

  1. rotate(byte[] bytes)
  2. rotate(Dimension rect)
  3. rotate(final Point2D pos, final Point2D center, final double dist)
  4. rotate(final Point2D vec, final double theta)
  5. rotate(Point p, double angle)
  6. rotate(Point2D.Double point, double dAngle)
  7. rotate(Shape shape, float angle, float x, float y)
  8. rotate_point(double rx, double ry, double angle, double cx, double cy)
  9. rotateArea(Area a, double rotation, Point2D rotateAround)