diff --git a/src/mol-math/linear-algebra/3d/mat3.ts b/src/mol-math/linear-algebra/3d/mat3.ts index 8e29f2477dda15cbc003a227d8fbde836700152d..571f7f94953f5f50a39f8c0ae2e80158e851294c 100644 --- a/src/mol-math/linear-algebra/3d/mat3.ts +++ b/src/mol-math/linear-algebra/3d/mat3.ts @@ -17,7 +17,7 @@ * furnished to do so, subject to the following conditions: */ -import { Mat4, Vec3 } from '../3d' +import { Mat4, Vec3, EPSILON } from '../3d' import { NumberArray } from '../../../mol-util/type-helpers'; interface Mat3 extends Array<number> { [d: number]: number, '@type': 'mat3', length: 9 } @@ -118,6 +118,11 @@ namespace Mat3 { return out; } + const _id = identity(); + export function isIdentity(m: Mat3, eps?: number) { + return areEqual(m, _id, typeof eps === 'undefined' ? EPSILON : eps); + } + export function hasNaN(m: Mat3) { for (let i = 0; i < 9; i++) if (isNaN(m[i])) return true return false