public static float[] rotateAroundCenter( final float[] array, final float n, final float n2, final float n3) { if (n != 0.0f) { final float degToRad = degToRad(n); final float sin = FloatMath.sin(degToRad); final float cos = FloatMath.cos(degToRad); for (int i = -2 + array.length; i >= 0; i -= 2) { final float n4 = array[i]; final float n5 = array[i + 1]; array[i] = n2 + (cos * (n4 - n2) - sin * (n5 - n3)); array[i + 1] = n3 + (sin * (n4 - n2) + cos * (n5 - n3)); } } return array; }
@Override // from IPoint public Point rotate(float angle, Point result) { float x = x(), y = y(); float sina = FloatMath.sin(angle), cosa = FloatMath.cos(angle); return result.set(x * cosa - y * sina, x * sina + y * cosa); }