diff --git a/src/mol-math/linear-algebra/3d/mat3.ts b/src/mol-math/linear-algebra/3d/mat3.ts
index c8a24df0e359c85eb1105f63b93fec980b082918..f18d68fb2dac152966f946dedbddceba64a7bcfd 100644
--- a/src/mol-math/linear-algebra/3d/mat3.ts
+++ b/src/mol-math/linear-algebra/3d/mat3.ts
@@ -97,6 +97,11 @@ namespace Mat3 {
         return out;
     }
 
+    export function hasNaN(m: Mat3) {
+        for (let i = 0; i < 9; i++) if (isNaN(m[i])) return true
+        return false
+    }
+
     /**
      * Creates a new Mat3 initialized with values from an existing matrix
      */
diff --git a/src/mol-math/linear-algebra/3d/mat4.ts b/src/mol-math/linear-algebra/3d/mat4.ts
index 24cee288c53f8661251f77b424229dc7627ae589..d6ac448acb5c59d77555024d8d32fa3382aec9b9 100644
--- a/src/mol-math/linear-algebra/3d/mat4.ts
+++ b/src/mol-math/linear-algebra/3d/mat4.ts
@@ -102,6 +102,11 @@ namespace Mat4 {
         return areEqual(m, _id, typeof eps === 'undefined' ? EPSILON.Value : eps);
     }
 
+    export function hasNaN(m: Mat4) {
+        for (let i = 0; i < 16; i++) if (isNaN(m[i])) return true
+        return false
+    }
+
     export function areEqual(a: Mat4, b: Mat4, eps: number) {
         for (let i = 0; i < 16; i++) {
             if (Math.abs(a[i] - b[i]) > eps) return false;
diff --git a/src/mol-math/linear-algebra/3d/quat.ts b/src/mol-math/linear-algebra/3d/quat.ts
index 119126fc2b19535c5b881f71e579d0db7f17043d..8c85b36c094284689029d852aa42a4cfb7c48f09 100644
--- a/src/mol-math/linear-algebra/3d/quat.ts
+++ b/src/mol-math/linear-algebra/3d/quat.ts
@@ -53,6 +53,10 @@ namespace Quat {
         out[3] = 1;
     }
 
+    export function hasNaN(q: Quat) {
+        return isNaN(q[0]) || isNaN(q[1]) || isNaN(q[2]) || isNaN(q[3])
+    }
+
     export function create(x: number, y: number, z: number, w: number) {
         const out = identity();
         out[0] = x;
diff --git a/src/mol-math/linear-algebra/3d/vec2.ts b/src/mol-math/linear-algebra/3d/vec2.ts
index b19586a1475fec82ce41b5ff200126e286221b3d..34bdb70bfd5d7a45c82c323c7462f775d3a6f7a6 100644
--- a/src/mol-math/linear-algebra/3d/vec2.ts
+++ b/src/mol-math/linear-algebra/3d/vec2.ts
@@ -40,6 +40,10 @@ namespace Vec2 {
         return out;
     }
 
+    export function hasNaN(a: Vec2) {
+        return isNaN(a[0]) || isNaN(a[1])
+    }
+
     export function toArray(a: Vec2, out: Helpers.NumberArray, offset: number) {
         out[offset + 0] = a[0];
         out[offset + 1] = a[1];
diff --git a/src/mol-math/linear-algebra/3d/vec3.ts b/src/mol-math/linear-algebra/3d/vec3.ts
index 852537d3570f269ca0d9bb05bf596c28dc10bc2e..55e6f7662eece83613b237245a79e05c3b3dd5fe 100644
--- a/src/mol-math/linear-algebra/3d/vec3.ts
+++ b/src/mol-math/linear-algebra/3d/vec3.ts
@@ -38,6 +38,10 @@ namespace Vec3 {
         return out;
     }
 
+    export function hasNaN(a: Vec3) {
+        return isNaN(a[0]) || isNaN(a[1]) || isNaN(a[2])
+    }
+
     export function fromObj(v: { x: number, y: number, z: number }): Vec3 {
         return create(v.x, v.y, v.z);
     }
diff --git a/src/mol-math/linear-algebra/3d/vec4.ts b/src/mol-math/linear-algebra/3d/vec4.ts
index db4f29c33c83b2809c6d58fa05d241cb020965d5..e54d6d4970a6b4468b50f4d8719c5eab24cd2149 100644
--- a/src/mol-math/linear-algebra/3d/vec4.ts
+++ b/src/mol-math/linear-algebra/3d/vec4.ts
@@ -48,6 +48,10 @@ namespace Vec4 {
         return out;
     }
 
+    export function hasNaN(a: Vec4) {
+        return isNaN(a[0]) || isNaN(a[1]) || isNaN(a[2]) || isNaN(a[3])
+    }
+
     export function toArray(a: Vec4, out: Helpers.NumberArray, offset: number) {
         out[offset + 0] = a[0];
         out[offset + 1] = a[1];