From 2cddbb72a621d474a6f688a384a55637198ae5dd Mon Sep 17 00:00:00 2001 From: Alexander Rose <alexander.rose@weirdbyte.de> Date: Sat, 13 Feb 2021 12:29:45 -0800 Subject: [PATCH] fix tests, remove more deps from mat4, quat --- src/mol-math/linear-algebra/3d/mat4.ts | 6 +++--- src/mol-math/linear-algebra/3d/quat.ts | 10 +++++----- src/mol-math/linear-algebra/_spec/tensor.spec.ts | 2 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mol-math/linear-algebra/3d/mat4.ts b/src/mol-math/linear-algebra/3d/mat4.ts index f57fc231c..d6ae371a6 100644 --- a/src/mol-math/linear-algebra/3d/mat4.ts +++ b/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); diff --git a/src/mol-math/linear-algebra/3d/quat.ts b/src/mol-math/linear-algebra/3d/quat.ts index 2f9872490..31707d809 100644 --- a/src/mol-math/linear-algebra/3d/quat.ts +++ b/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]; diff --git a/src/mol-math/linear-algebra/_spec/tensor.spec.ts b/src/mol-math/linear-algebra/_spec/tensor.spec.ts index 923e6455e..f2a283bb7 100644 --- a/src/mol-math/linear-algebra/_spec/tensor.spec.ts +++ b/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++) { -- GitLab