Skip to main content

KMatrix4

kds-plugin-document / Exports / KMatrix4

Interface: KMatrix4

KMatrix4表示一个四行四列矩阵。

The KMatrix4 class represents a 4x4 matrix.

Table of contents​

Properties​

Methods​

Properties​

elements​

• Readonly elements: number[]

column-major list of matrix values.

Defined in​

api.d.ts:11245

Methods​

clone​

▸ clone(): KMatrix4

复制一个当前矩阵。

Return the cloned matrix of this.

Returns​

KMatrix4

复制的矩阵。

The cloned matrix.

Defined in​

api.d.ts:11307


decompose​

▸ decompose(throwOnDegenerate?): KMatrix4[]

将当前矩阵分解为平移矩阵,旋转矩阵,剪切矩阵和缩放矩阵。当前矩阵必须是仿射变换矩阵。

decompose current matrix into translation, rotation, shear, and scale matrices. Current matrix should be affine transformation matrix.

If throwOnDegenerate is not set and the matrix is not decomposable, set this to the 3x3 identity matrix and an exception will be threw.

Parameters​

NameTypeDescription
throwOnDegenerate?boolean默认值是true。 The default value is true.

Returns​

KMatrix4[]

如果矩阵符合要求,那么返回[translation, rotate, shear, scale],否则返回空数组。

Return [translation, rotate, shear, scale] if current matrix is affine transformation matrix, otherwise return empty array.

Defined in​

api.d.ts:11343


extractBasis​

▸ extractBasis(): Object

Extracts the basis of this matrix into the three axis vectors provided.

Returns​

Object

NameType
xAxisKVector3d
yAxisKVector3d
zAxisKVector3d

Defined in​

api.d.ts:11353


extractScale​

▸ extractScale(): KMatrix4

Extract the scale matrix from the matrix. will return null when this basis parts are not orthogonal

Returns​

KMatrix4

Defined in​

api.d.ts:11348


extractTranslation​

▸ extractTranslation(): KVector3d

Extract the translation vector from the matrix.

Returns​

KVector3d

Defined in​

api.d.ts:11361


fromArray​

▸ fromArray(array, offset?): void

Sets the elements of this matrix based on an array in column-major format.

Parameters​

NameTypeDescription
arraynumber[]the array to read the elements from.
offset?number( optional ) offset into the array. Default is 0.

Returns​

void

Defined in​

api.d.ts:11367


inverse​

▸ inverse(throwOnDegenerate?): void

将当前矩阵进行求逆。 如果throwOnDegenerate未设置且矩阵不可逆,则当前矩阵变成三位三列单位矩阵,并且抛出异常。

Inverse this matrix. If throwOnDegenerate is not set and the matrix is not invertible, set this to the 3x3 identity matrix and an exception will be threw.

Parameters​

NameTypeDescription
throwOnDegenerate?boolean默认值是true。 The default value is true.

Returns​

void

Defined in​

api.d.ts:11257


inversed​

▸ inversed(throwOnDegenerate?): KMatrix4

将当前矩阵进行求逆。 如果throwOnDegenerate未设置且矩阵不可逆,则返回三位三列单位矩阵,并且抛出异常。

Inverse this matrix. If throwOnDegenerate is not set and the matrix is not invertible, set this to the 3x3 identity matrix and an exception will be threw.

Parameters​

NameTypeDescription
throwOnDegenerate?boolean默认值是true。 The default value is true.

Returns​

KMatrix4

逆矩阵。

a new inversed matrix

Defined in​

api.d.ts:11273


isEqual​

▸ isEqual(other, tolerance?): boolean

检查两个矩阵在特定容差下是否相等。

Check whether two matrices are equal with specified tolerances.

Parameters​

NameTypeDescription
otherKMatrix4被比较的矩阵。 The matrix to compare this matrix with.
tolerance?number指定容差,默认值是1e-6。 The specified tolerance.The default value is 1e-6.

Returns​

boolean

如果相等则返回true。

Return true if equal, otherwise return false.

Defined in​

api.d.ts:11325


multiplied​

▸ multiplied(matrix): KMatrix4

对当前矩阵右乘一矩阵并得到新矩阵。

Return a new matrix for post-multiplying this matrix by the input matrix.

Parameters​

NameTypeDescription
matrixKMatrix4传入的用于右乘矩阵。 the input matrix.

Returns​

KMatrix4

一个新的矩阵。

a new multiplied matrix.

Defined in​

api.d.ts:11297


multiply​

▸ multiply(matrix): void

对当前矩阵右乘一矩阵。

Post-multiplies this matrix by the input matrix.

Parameters​

NameTypeDescription
matrixKMatrix4传入的用于右乘矩阵。 the input matrix.

Returns​

void

Defined in​

api.d.ts:11283


toArray​

▸ toArray(array?, offset?): number[]

Writes the elements of this matrix to an array in column-major format.

Parameters​

NameTypeDescription
array?number[](optional) array to store the resulting vector in.
offset?number(optional) offset in the array at which to put the result.

Returns​

number[]

the array in column-major format

Defined in​

api.d.ts:11374