Options
All
• Public
• Public/Protected
• All

Class Mat4

Constructors

constructor

• newMat4(other: Mat4): Mat4
• newMat4(m00?: undefined | number, m01?: undefined | number, m02?: undefined | number, m03?: undefined | number, m04?: undefined | number, m05?: undefined | number, m06?: undefined | number, m07?: undefined | number, m08?: undefined | number, m09?: undefined | number, m10?: undefined | number, m11?: undefined | number, m12?: undefined | number, m13?: undefined | number, m14?: undefined | number, m15?: undefined | number): Mat4

Properties

m00: number

m01: number

m02: number

m03: number

m04: number

m05: number

m06: number

m07: number

m08: number

m09: number

m10: number

m11: number

m12: number

m13: number

m14: number

m15: number

Static IDENTITY

IDENTITY: {} = Object.freeze(new Mat4())

Methods

add

• add(mat: Mat4): this
• 矩阵加法。将当前矩阵与指定矩阵的相加，结果返回给当前矩阵。

Parameters

• mat: Mat4

the second operand

determinant

• determinant(): number

equals

• equals(other: Mat4, epsilon?: number): boolean
• 判断当前矩阵是否在误差范围内与指定矩阵相等。

Parameters

• other: Mat4

Comparative matrix

• Default value epsilon: number = EPSILON

The error allowed. It`s should be a non-negative number.

Returns boolean

Returns `true' when the elements of both matrices are equal; otherwise returns`false'.

fromQuat

• fromQuat(q: Quat): this
• 重置当前矩阵的值，使其表示指定四元数表示的旋转变换。

Parameters

• q: Quat

Rotation quaternion

Returns this

`this`

fromRTS

• 重置当前矩阵的值，使其表示指定的旋转、缩放、位移依次组合的变换。

Parameters

• q: Quat

Rotation quaternion

• v: Vec3

Translation vector

• s: Vec3

Scaling vector

Returns this

`this`

getRotation

• 从当前矩阵中计算出旋转变换的部分，并以四元数的形式赋值给出口四元数。

Parameters

• out: Quat

Vector to receive rotation component

getScale

• 从当前矩阵中计算出缩放变换的部分，并以各个轴上缩放的形式赋值给出口向量。

Parameters

• out: Vec3

Vector to receive scale component

getTranslation

• 从当前矩阵中计算出位移变换的部分，并以各个轴上位移的形式赋值给出口向量。

Parameters

• out: Vec3

Vector to receive translation component.

identity

• identity(): this

invert

• invert(): this
• 计算当前矩阵的逆矩阵。注意，在矩阵不可逆时，会返回一个全为 0 的矩阵。

multiply

• multiply(mat: Mat4): this
• 矩阵乘法。将当前矩阵左乘指定矩阵的结果赋值给当前矩阵。

Parameters

• mat: Mat4

the second operand

multiplyScalar

• multiplyScalar(scalar: number): this
• 矩阵数乘。将当前矩阵与指定标量的数乘结果赋值给当前矩阵。

Parameters

• scalar: number

amount to scale the matrix's elements by

rotate

• rotate(rad: number, axis: Vec3): null | this
• 将当前矩阵左乘旋转矩阵的结果赋值给当前矩阵，旋转矩阵由旋转轴和旋转角度给出。

Parameters

• rad: number

Angle of rotation (in radians)

• axis: Vec3

Axis of rotation

scale

• scale(vec: Vec3): this
• 将当前矩阵左乘缩放矩阵的结果赋值给当前矩阵，缩放矩阵由各个轴的缩放给出。

Parameters

• vec: Vec3

vector to scale by

set

• set(other: Mat4): any
• set(m00?: undefined | number, m01?: undefined | number, m02?: undefined | number, m03?: undefined | number, m04?: undefined | number, m05?: undefined | number, m06?: undefined | number, m07?: undefined | number, m08?: undefined | number, m09?: undefined | number, m10?: undefined | number, m11?: undefined | number, m12?: undefined | number, m13?: undefined | number, m14?: undefined | number, m15?: undefined | number): any
• 设置当前矩阵使其与指定矩阵相等。

Parameters

• other: Mat4

Specified matrix.

this

• 设置当前矩阵指定元素值。

this

strictEquals

• strictEquals(other: Mat4): boolean
• 判断当前矩阵是否与指定矩阵相等。

Parameters

• other: Mat4

Comparative matrix

Returns boolean

Returns `true' when the elements of both matrices are equal; otherwise returns`false'.

subtract

• subtract(mat: Mat4): this
• 计算矩阵减法。将当前矩阵减去指定矩阵的结果赋值给当前矩阵。

Parameters

• mat: Mat4

the second operand

toString

• toString(): string

translate

• translate(vec: Vec3): this
• 将当前矩阵左乘位移矩阵的结果赋值给当前矩阵，位移矩阵由各个轴的位移给出。

Parameters

• vec: Vec3

vector to translate by

transpose

• transpose(): this

Static add

• add<Out>(out: Out, a: Out, b: Out): Out
• 逐元素矩阵加法

Static clone

• clone<Out>(a: Out): Mat4
• 获得指定矩阵的拷贝

Static copy

• copy<Out>(out: Out, a: Out): Out
• 复制目标矩阵

Static determinant

• determinant<Out>(a: Out): number
• 矩阵行列式

Static equals

• equals<Out>(a: Out, b: Out, epsilon?: number): boolean
• 排除浮点数误差的矩阵近似等价判断

Static fromArray

• fromArray<Out>(out: Out, arr: IWritableArrayLike<number>, ofs?: number): Out
• 数组转矩阵

Parameters

• Default value ofs: number = 0

Array Start Offset

Static fromQuat

• fromQuat<Out>(out: Out, q: Quat): Out
• 根据指定的旋转信息计算矩阵

Static fromRT

• fromRT<Out, VecLike>(out: Out, q: Quat, v: VecLike): Out
• 根据旋转和位移信息计算矩阵

Static fromRTS

• fromRTS<Out, VecLike>(out: Out, q: Quat, v: VecLike, s: VecLike): Out
• 根据旋转、位移、缩放信息计算矩阵，以 S->R->T 的顺序应用

Static fromRTSOrigin

• fromRTSOrigin<Out, VecLike>(out: Out, q: Quat, v: VecLike, s: VecLike, o: VecLike): Out
• 根据指定的旋转、位移、缩放及变换中心信息计算矩阵，以 S->R->T 的顺序应用

Parameters

• q: Quat

Rotation quaternion

• v: VecLike

Translation vector

• s: VecLike

Scaling vector

• o: VecLike

transformation Center

Static fromRotation

• fromRotation<Out, VecLike>(out: Out, rad: number, axis: VecLike): null | Out
• 计算旋转矩阵

Static fromScaling

• fromScaling<Out, VecLike>(out: Out, v: VecLike): Out
• 计算缩放矩阵

Static fromTranslation

• fromTranslation<Out, VecLike>(out: Out, v: VecLike): Out
• 计算位移矩阵

Static fromXRotation

• fromXRotation<Out>(out: Out, rad: number): Out
• 计算绕 X 轴的旋转矩阵

Static fromYRotation

• fromYRotation<Out>(out: Out, rad: number): Out
• 计算绕 Y 轴的旋转矩阵

Static fromZRotation

• fromZRotation<Out>(out: Out, rad: number): Out
• 计算绕 Z 轴的旋转矩阵

Static frustum

• frustum<Out>(out: Out, left: number, right: number, bottom: number, top: number, near: number, far: number): Out
• 根据指定的视锥体信息计算矩阵

Parameters

• left: number

The X coordinate of the left side of the near projection plane in view space.

• right: number

The X coordinate of the right side of the near projection plane in view space.

• bottom: number

The Y coordinate of the bottom side of the near projection plane in view space.

• top: number

The Y coordinate of the top side of the near projection plane in view space.

• near: number

Z distance to the near plane from the origin in view space.

• far: number

Z distance to the far plane from the origin in view space.

Static getRotation

• getRotation<Out>(out: Quat, mat: Out): Quat
• 提取矩阵的旋转信息, 默认输入矩阵不含有缩放信息，如考虑缩放应使用 `toRTS` 函数。

Static getScaling

• getScaling<Out, VecLike>(out: VecLike, mat: Out): VecLike
• 提取矩阵的缩放信息, 默认矩阵中的变换以 S->R->T 的顺序应用

Static getTranslation

• getTranslation<Out, VecLike>(out: VecLike, mat: Out): VecLike
• 提取矩阵的位移信息, 默认矩阵中的变换以 S->R->T 的顺序应用

Static identity

• identity<Out>(out: Out): Out
• 将目标赋值为单位矩阵

Static inverseTranspose

• inverseTranspose<Out>(out: Out, a: Out): null | Out
• 计算逆转置矩阵

Static invert

• invert<Out>(out: Out, a: Out): Out
• 矩阵求逆，注意，在矩阵不可逆时，会返回一个全为 0 的矩阵。

Static lookAt

• lookAt<Out, VecLike>(out: Out, eye: VecLike, center: VecLike, up: VecLike): Out
• 根据视点计算矩阵，注意 `eye - center` 不能为零向量或与 `up` 向量平行

Parameters

• eye: VecLike

The source point.

• center: VecLike

The target point.

• up: VecLike

The vector describing the up direction.

Static multiply

• multiply<Out>(out: Out, a: Out, b: Out): Out
• 矩阵乘法

Static multiplyScalar

• multiplyScalar<Out>(out: Out, a: Out, b: number): Out
• 矩阵标量乘法

Static multiplyScalarAndAdd

• multiplyScalarAndAdd<Out>(out: Out, a: Out, b: Out, scale: number): Out
• 逐元素矩阵标量乘加: A + B * scale

Static ortho

• ortho<Out>(out: Out, left: number, right: number, bottom: number, top: number, near: number, far: number, minClipZ?: number, projectionSignY?: number): Out
• 计算正交投影矩阵

Parameters

• left: number

Left-side x-coordinate.

• right: number

Right-side x-coordinate.

• bottom: number

Bottom y-coordinate.

• top: number

Top y-coordinate.

• near: number

Near depth clipping plane value.

• far: number

Far depth clipping plane value.

Static perspective

• perspective<Out>(out: Out, fov: number, aspect: number, near: number, far: number, isFOVY?: boolean, minClipZ?: number, projectionSignY?: number): Out
• 计算透视投影矩阵

Parameters

• aspect: number

Aspect ratio

• near: number

Near depth clipping plane value.

• far: number

Far depth clipping plane value.

Static rotate

• rotate<Out, VecLike>(out: Out, a: Out, rad: number, axis: VecLike): null | Out
• 在给定矩阵变换基础上加入新旋转变换

Parameters

• rad: number

Angle of rotation (in radians)

• axis: VecLike

axis of rotation

Static rotateX

• rotateX<Out>(out: Out, a: Out, rad: number): Out
• 在给定矩阵变换基础上加入绕 X 轴的旋转变换

Parameters

• rad: number

Angle of rotation (in radians)

Static rotateY

• rotateY<Out>(out: Out, a: Out, rad: number): Out
• 在给定矩阵变换基础上加入绕 Y 轴的旋转变换

Parameters

• rad: number

Angle of rotation (in radians)

Static rotateZ

• rotateZ<Out>(out: Out, a: Out, rad: number): Out
• 在给定矩阵变换基础上加入绕 Z 轴的旋转变换

Parameters

• rad: number

Angle of rotation (in radians)

Static scale

• scale<Out, VecLike>(out: Out, a: Out, v: VecLike): Out
• 在给定矩阵变换基础上加入新缩放变换

Static set

• set<Out>(out: Out, 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): Out
• 设置矩阵值

Static strictEquals

• strictEquals<Out>(a: Out, b: Out): boolean
• 矩阵等价判断

Static subtract

• subtract<Out>(out: Out, a: Out, b: Out): Out
• 逐元素矩阵减法

Static toArray

• toArray<Out>(out: Out, m: IMat4Like, ofs?: number): Out
• 矩阵转数组

Parameters

• Default value ofs: number = 0

Array Start Offset

Static toRTS

• toRTS<Out, VecLike>(m: Out, q: Quat, v: VecLike, s: VecLike): void
• 提取旋转、位移、缩放信息， 默认矩阵中的变换以 S->R->T 的顺序应用

Static transform

• transform<Out, VecLike>(out: Out, a: Out, v: VecLike): Out
• 在给定矩阵变换基础上加入变换

Static translate

• translate<Out, VecLike>(out: Out, a: Out, v: VecLike): Out
• 在给定矩阵变换基础上加入新位移变换

Static transpose

• transpose<Out>(out: Out, a: Out): Out
• 转置矩阵

Returns Out

Generated using TypeDoc