warscript
Version:
A typescript library for Warcraft III using Warpack.
74 lines (73 loc) • 2.55 kB
TypeScript
/** @noSelfInFile */
declare class Matrix2 {
static get identity(): Matrix2;
mul: (matrix: Matrix2, dest?: Matrix2) => Matrix2;
sub: (matrix: Matrix2, dest?: Matrix2) => Matrix2;
private _values;
constructor(values?: number[]);
/**
* Creates a Matrix2 from a given angle
* This is equivalent to (but much faster than):
* m = Matrix2.identity;
* m.rotate(radians, m);
*
* @param {number} radians the angle to rotate the matrix by
* @param {Matrix2} dest the receiving matrix
* @returns {Matrix2} dest
*/
static fromRotation(radians: number, dest?: Matrix2): Matrix2;
/**
* Creates a matrix from a vector scaling
* This is equivalent to (but much faster than):
* m = Matrix2.identity;
* m.scale(v, m);
*
* @param {Vec2} v the scaling vector
* @param {Matrix2} dest the receiving matrix
* @returns {Matrix2} dest
*/
static fromScaling(v: Vec2, dest?: Matrix2): Matrix2;
at(index: number): number;
init(values: number[]): Matrix2;
copy(dest?: Matrix2): Matrix2;
all(): number[];
row(index: number): number[];
col(index: number): number[];
equals(matrix: Matrix2, threshold?: number): boolean;
determinant(): number;
setIdentity(): Matrix2;
transpose(dest?: Matrix2): Matrix2;
inverse(dest?: Matrix2): Matrix2 | undefined;
/**
* Calculates the adjugate of a Matrix2
* @param {Matrix2} dest the receiving matrix
* @returns {Matrix2} dest
*/
adjoint(dest?: Matrix2): Matrix2;
multiply(matrix: Matrix2, dest?: Matrix2): Matrix2;
/**
* Rotates a Matrix2 by the given angle
* @param {number} radians the angle to rotate the matrix by
* @param {Matrix2} dest the receiving matrix
* @returns {Matrix2} dest
*/
rotate(radians: number, dest?: Matrix2): Matrix2;
/**
* Scales a Matrix2 by the dimensions in the given Vector2
* @param {Vec2} v the Vector2 to scale the matrix by
* @param {Matrix2} dest the receiving matrix
* @returns {Matrix2} dest
*/
scale(v: Vec2, dest?: Matrix2): Matrix2;
toString(): string;
/**
* Returns the Frobenius norm of a Matrix2
* @returns {number} Frobenius norm
*/
frobenius(): number;
add(matrix: Matrix2, dest?: Matrix2): Matrix2;
subtract(matrix: Matrix2, dest?: Matrix2): Matrix2;
exactEquals(matrix: Matrix2): boolean;
multiplyScalar(scalar: number, dest?: Matrix2): Matrix2;
}
export default Matrix2;