@openhps/core
Version:
Open Hybrid Positioning System - Core component
30 lines (26 loc) • 828 B
text/typescript
import { SerializableArrayMember, SerializableObject, NumberType } from '../../data/decorators';
import * as THREE from './_internal';
/**
* Serializable THREE.js Matrix3
*/
export class Matrix3 extends THREE.Matrix3 {
public elements: number[];
/**
* Create a matrix from array
* @param {number[][]} array Array
* @returns {Matrix3} Matrix3
*/
public static fromArray<T extends Matrix3>(array: number[][]): T {
const matrix = new this();
matrix.fromArray([].concat(...array));
matrix.transpose();
return matrix as T;
}
public clone(): this {
return new (this.constructor as new () => this)().fromArray(this.elements) as this;
}
}