From 4287d158b662299b3d6b972e552cb2d3e2df3796 Mon Sep 17 00:00:00 2001
From: Alexander Rose <alex.rose@rcsb.org>
Date: Fri, 27 Sep 2019 17:18:06 -0700
Subject: [PATCH] add Mat3.isIdentity

---
 src/mol-math/linear-algebra/3d/mat3.ts | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mol-math/linear-algebra/3d/mat3.ts b/src/mol-math/linear-algebra/3d/mat3.ts
index 8e29f2477..571f7f949 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
-- 
GitLab