Java Graphics Rotate rotate(Point p, double angle)

Here you can find the source of rotate(Point p, double angle)

Description

rotate

License

Apache License

Declaration

private static Point rotate(Point p, double angle) 

Method Source Code

//package com.java2s;
/**//from w  w w  .  j av a 2s.co  m
 * 
 * Copyright 2008 - 2009
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 * 
 * @project loonframework
 * @author chenpeng
 * @email?ceponline@yahoo.com.cn
 * @version 0.1
 */

import java.awt.Point;

public class Main {
    private static Point rotate(Point p, double angle) {
        double c = Math.cos(angle);
        double s = Math.sin(angle);
        return new Point((int) (p.x * c - p.y * s), (int) (p.x * s + p.y * c));
    }
}

Related

  1. rotate(AffineTransform transform, float angleInDegrees)
  2. rotate(byte[] bytes)
  3. rotate(Dimension rect)
  4. rotate(final Point2D pos, final Point2D center, final double dist)
  5. rotate(final Point2D vec, final double theta)
  6. rotate(Point toRotate, float tetta)
  7. rotate(Point2D.Double point, double dAngle)
  8. rotate(Shape shape, float angle, float x, float y)
  9. rotate_point(double rx, double ry, double angle, double cx, double cy)