UNPKG

ts-scikit

Version:

A scientific toolkit written in Typescript

159 lines (158 loc) 6.04 kB
/** * A 4x4 matrix. */ import { Vector3 } from './vector3'; import { Point3 } from './point3'; import { Point4 } from './point4'; export declare class Matrix44 { private _m; /** * Constructs an identity matrix. */ static AsIdentity(): Matrix44; /** * Constructs a new matrix from an array(16) of values. * @param arr an array of values. * @param columnMajorOrder true, if array is organized in column-major order; false, if row-major order. */ static FromArray(arr: number[], columnMajorOrder?: boolean): Matrix44; /** * Constructs a new matrix from another. * @param mat a matrix. */ static FromMatrix44(mat: Matrix44): Matrix44; /** * Constructs a matrix with specified elements. * @param m00 the element with (row, col) indices (0, 0) * @param m01 the element with (row, col) indices (0, 1) * @param m02 the element with (row, col) indices (0, 2) * @param m03 the element with (row, col) indices (0, 3) * @param m10 the element with (row, col) indices (1, 0) * @param m11 the element with (row, col) indices (1, 1) * @param m12 the element with (row, col) indices (1, 2) * @param m13 the element with (row, col) indices (1, 3) * @param m20 the element with (row, col) indices (2, 0) * @param m21 the element with (row, col) indices (2, 1) * @param m22 the element with (row, col) indices (2, 2) * @param m23 the element with (row, col) indices (2, 3) * @param m30 the element with (row, col) indices (3, 0) * @param m31 the element with (row, col) indices (3, 1) * @param m32 the element with (row, col) indices (3, 2) * @param m33 the element with (row, col) indices (3, 3) */ constructor(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number); /** * Gets the column-major array of values for this matrix. */ get m(): number[]; /** * Computes the matrix product C = AB. * The product may be computed in place. */ private mul; /** * Computes the matrix product C = AB'. * The product may be computed in place. */ private mult; /** * Computes the matrix product C = A'B. * The product may be computed in place. */ private tmul; /** * Compute the inverse of matrix A. * * This method is based off of Cramer's Rule for the inverse of a matrix * and its implementation follows that described by Streaming SIMD * Extensions - Inverse of 4x4 Matrix, Intel Corporation, Techncial * Report AP-928. * @param a array of matrix A. * @returns the inverse of array A. */ private invert; /** * Returns a copy (by value) of this matrix. * @returns a copy of this matrix. */ clone(): Matrix44; /** * Returns the transpose of this matrix. * @returns the transpose of this matrix. */ transpose(): Matrix44; /** * Replaces this matrix with its transpose. * @returns the transpose of this matrix. */ transposeEquals(): Matrix44; /** * Returns the inverse of this matrix. * @returns the inverse of this matrix. */ inverse(): Matrix44; /** * Inverts this matrix. * @returns the inverse of this matrix. */ inverseEquals(): Matrix44; /** * Returns the product MA of this matrix M and matrix A. * @param a the matrix A. * @returns the product MA. */ times(a: Matrix44 | Vector3 | Point3 | Point4): Matrix44 | Vector3 | Point3 | Point4; /** * Replaces this matrix M with the product MA. * @param a the matrix A. * @returns the product MA. */ timesEquals(a: Matrix44): Matrix44; /** * Sets all elements of this matrix. * @param m00 the element with (row, col) indices (0, 0) * @param m01 the element with (row, col) indices (0, 1) * @param m02 the element with (row, col) indices (0, 2) * @param m03 the element with (row, col) indices (0, 3) * @param m10 the element with (row, col) indices (1, 0) * @param m11 the element with (row, col) indices (1, 1) * @param m12 the element with (row, col) indices (1, 2) * @param m13 the element with (row, col) indices (1, 3) * @param m20 the element with (row, col) indices (2, 0) * @param m21 the element with (row, col) indices (2, 1) * @param m22 the element with (row, col) indices (2, 2) * @param m23 the element with (row, col) indices (2, 3) * @param m30 the element with (row, col) indices (3, 0) * @param m31 the element with (row, col) indices (3, 1) * @param m32 the element with (row, col) indices (3, 2) * @param m33 the element with (row, col) indices (3, 3) */ set(m00: number, m01: number, m02: number, m03: number, m10: number, m11: number, m12: number, m13: number, m20: number, m21: number, m22: number, m23: number, m30: number, m31: number, m32: number, m33: number): void; /** * Returns the product MA of this matrix M and a matrix A. * @param a the matrix A. * @return the product MA. */ timesMatrix44(a: Matrix44): Matrix44; /** * Returns the product Mv of this matrix M and a vector v. * Uses only the upper-left 3-by-3 elements of this matrix. * @param v the vector v. * @return the product Mv. */ timesVector3(v: Vector3): Vector3; /** * Returns the product Mp of this matrix M and a point p. * The coordinate w of the specified point is assume to equal 1.0, * and the returned point is homogenized, * @param p the point p. * @returns the product Mp. */ timesPoint3(p: Point3): Point3; /** * Returns the product Mp of this matrix M and a point p. * @param p the point p. * @returns the product Mp. */ timesPoint4(p: Point4): Point4; }