Browse Source

fix tests, remove more deps from mat4, quat

Alexander Rose 4 years ago
parent
commit
2cddbb72a6

+ 3 - 3
src/mol-math/linear-algebra/3d/mat4.ts

@@ -1070,9 +1070,9 @@ namespace Mat4 {
         return Math.sqrt(Math.max(scaleXSq, scaleYSq, scaleZSq));
     }
 
-    const xAxis = Vec3.create(1, 0, 0);
-    const yAxis = Vec3.create(0, 1, 0);
-    const zAxis = Vec3.create(0, 0, 1);
+    const xAxis = [1, 0, 0] as Vec3;
+    const yAxis = [0, 1, 0] as Vec3;
+    const zAxis = [0, 0, 1] as Vec3;
 
     /** Rotation matrix for 90deg around x-axis */
     export const rotX90: ReadonlyMat4 = fromRotation(zero(), degToRad(90), xAxis);

+ 5 - 5
src/mol-math/linear-algebra/3d/quat.ts

@@ -277,7 +277,7 @@ namespace Quat {
         return out;
     }
 
-    const fromUnitVec3Temp = Vec3();
+    const fromUnitVec3Temp = [0, 0, 0] as Vec3;
     /** Quaternion from two normalized unit vectors. */
     export function fromUnitVec3 (out: Quat, a: Vec3, b: Vec3) {
         // assumes a and b are normalized
@@ -376,9 +376,9 @@ namespace Quat {
      *
      * Both vectors are assumed to be unit length.
      */
-    const rotTmpVec3 = Vec3();
-    const rotTmpVec3UnitX = Vec3.create(1, 0, 0);
-    const rotTmpVec3UnitY = Vec3.create(0, 1, 0);
+    const rotTmpVec3 = [0, 0, 0] as Vec3;
+    const rotTmpVec3UnitX = [1, 0, 0] as Vec3;
+    const rotTmpVec3UnitY = [0, 1, 0] as Vec3;
     export function rotationTo(out: Quat, a: Vec3, b: Vec3) {
         let dot = Vec3.dot(a, b);
         if (dot < -0.999999) {
@@ -421,7 +421,7 @@ namespace Quat {
      * axes. Each axis is a vec3 and is expected to be unit length and
      * perpendicular to all other specified axes.
      */
-    const axesTmpMat = Mat3();
+    const axesTmpMat = [0, 0, 0, 0, 0, 0, 0, 0, 0] as Mat3;
     export function setAxes(out: Quat, view: Vec3, right: Vec3, up: Vec3) {
         axesTmpMat[0] = right[0];
         axesTmpMat[3] = right[1];

+ 1 - 1
src/mol-math/linear-algebra/_spec/tensor.spec.ts

@@ -52,7 +52,7 @@ describe('tensor', () => {
     it('mat4 equiv', () => {
         const M = T.ColumnMajorMatrix(4, 4);
         const data = M.create();
-        const m = Mat4.zero();
+        const m = Mat4();
 
         for (let i = 0; i < 4; i++) {
             for (let j = 0; j < 4; j++) {