Skip to content
Snippets Groups Projects
Commit 4287d158 authored by Alexander Rose's avatar Alexander Rose
Browse files

add Mat3.isIdentity

parent 4e9b5691
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment