Преглед на файлове

adding missing function

Raanan Weber преди 5 години
родител
ревизия
9a2e1c5fe5
променени са 1 файла, в които са добавени 19 реда и са изтрити 0 реда
  1. 19 0
      src/Maths/math.vector.ts

+ 19 - 0
src/Maths/math.vector.ts

@@ -840,6 +840,17 @@ export class Vector3 {
     }
 
     /**
+     * Negate this vector in place
+     * @returns this
+     */
+    public negateInPlace(): Vector3 {
+        this.x *= -1;
+        this.y *= -1;
+        this.z *= -1;
+        return this;
+    }
+
+    /**
      * Multiplies the Vector3 coordinates by the float "scale"
      * @param scale defines the multiplier factor
      * @returns the current updated Vector3
@@ -2654,6 +2665,14 @@ export class Quaternion {
         return otherQuaternion && this.x === otherQuaternion.x && this.y === otherQuaternion.y && this.z === otherQuaternion.z && this.w === otherQuaternion.w;
     }
 
+    public equalsWithEpsilon(otherQuaternion: DeepImmutable<Quaternion>, epsilon: number = Epsilon): boolean {
+        return otherQuaternion
+            && Scalar.WithinEpsilon(this.x, otherQuaternion.x, epsilon)
+            && Scalar.WithinEpsilon(this.y, otherQuaternion.y, epsilon)
+            && Scalar.WithinEpsilon(this.z, otherQuaternion.z, epsilon)
+            && Scalar.WithinEpsilon(this.w, otherQuaternion.w, epsilon);
+    }
+
     /**
      * Clone the current quaternion
      * @returns a new quaternion copied from the current one