Bläddra i källkod

Merge pull request #276 from daner/quaternioninverse

Added function to calculate the inverse of a quaternion.
deltakosh 11 år sedan
förälder
incheckning
57dac416ea
1 ändrade filer med 4 tillägg och 0 borttagningar
  1. 4 0
      Babylon/Math/babylon.math.ts

+ 4 - 0
Babylon/Math/babylon.math.ts

@@ -1104,6 +1104,10 @@
 
             return new Quaternion((num3 * left.x) + (num2 * right.x), (num3 * left.y) + (num2 * right.y), (num3 * left.z) + (num2 * right.z), (num3 * left.w) + (num2 * right.w));
         }
+		
+		public static Inverse(q: Quaternion): Quaternion {
+			return new Quaternion(-q.x, -q.y, -q.z, q.w);
+		}		
     }
 
     export class Matrix {