예제 #1
0
 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;
 }
예제 #2
0
 public float distance(final float n, final float n2, final float n3, final float n4) {
   final float n5 = n3 - n;
   final float n6 = n4 - n2;
   return FloatMath.sqrt(n5 * n5 + n6 * n6);
 }