@turbox3d/math
Version:
Large-scale graphics application math library
57 lines (56 loc) • 2.02 kB
TypeScript
import { Matrix4 } from './Matrix4';
import { Vector2 } from './Vector2';
import { Vector3 } from './Vector3';
declare class Matrix3 {
readonly isMatrix3: boolean;
elements: number[];
constructor();
set(n11: number, n12: number, n13: number, n21: number, n22: number, n23: number, n31: number, n32: number, n33: number): this;
identity(): this;
clone(): Matrix3;
copy(m: Matrix3): this;
extractBasis(xAxis: Vector3, yAxis: Vector3, zAxis: Vector3): this;
setFromMatrix4(m: Matrix4): this;
add(b: Matrix3): this;
added(b: Matrix3): Matrix3;
multiply(m: Matrix3): this;
multiplied(m: Matrix3): Matrix3;
premultiply(m: Matrix3): this;
premultiplied(m: Matrix3): Matrix3;
multiplyMatrices(a: Matrix3, b: Matrix3): this;
multiplyScalar(s: number): this;
determinant(): number;
invert(): this;
inverted(): Matrix3;
transpose(): this;
getNormalMatrix(matrix4: Matrix4): this;
transposeIntoArray(r: number[]): this;
setUvTransform(tx: number, ty: number, sx: number, sy: number, rotation: number, cx: number, cy: number): this;
scale(sx: number, sy: number): this;
rotate(theta: number): this;
translate(tx: number, ty: number): this;
equals(matrix: Matrix3): boolean;
fromArray(array: number[] | ArrayLike<number>, offset?: number): this;
toArray(array?: number[], offset?: number): number[];
/** 缩放,注意和 scale 的区别,这个不会影响 position */
doScale(sx: number, sy: number): this;
/**
* 设置成缩放矩阵
*/
setScale(scale: Vector2): this;
/**
* 设置成旋转矩阵
*/
setRotation(angle: number): this;
/**
* 设置成平移矩阵
*/
setTranslation(translation: Vector2): this;
/**
* 把位置信息放到没用的两个矩阵索引
*/
setPosition(position: Vector2): void;
getPosition(): Vector2;
compose(position: Vector2, rotation: number, scale?: Vector2): this;
}
export { Matrix3 };