Here you can find the source of rotatePoint2D(final Point aPoint, final float aDeg)
public static Point rotatePoint2D(final Point aPoint, final float aDeg)
//package com.java2s; /* /*w w w. ja va 2 s. co m*/ * Copyright 2012 Samuel Taylor * * This file is part of darkFunction Editor * * darkFunction Editor is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * darkFunction Editor is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * You should have received a copy of the GNU General Public License * along with darkFunction Editor. If not, see <http://www.gnu.org/licenses/>. */ import java.awt.Point; public class Main { public static Point rotatePoint2D(final Point aPoint, final float aDeg) { double a = Math.toRadians(aDeg); Point p = new Point(); p.x = (int) ((aPoint.x * Math.cos(a)) - (aPoint.y * Math.sin(a))); p.y = (int) ((aPoint.y * Math.cos(a)) + (aPoint.x * Math.sin(a))); return p; } }