Skip to main content

Class: ProjectionMatrix

一个表示 4*4 的矩阵 1--0--0--0 | | | | 0--1--0--0 | | | | 0--0--1--0 | | | | 0--0--0--1

const m = new Matrix4();

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new ProjectionMatrix(m00?, m01?, m02?, m03?, m10?, m11?, m12?, m13?, m20?, m21?, m22?, m23?, m30?, m31?, m32?, m33?): ProjectionMatrix

Parameters

NameTypeDefault valueDescription
m00number1第一行第一列,默认是 1
m01number0第一行第二列,默认是 0
m02number0第一行第三列,默认是 0
m03number0第一行第四列,默认是 0
m10number0第二行第一列,默认是 0
m11number1第二行第二列,默认是 1
m12number0第二行第三列,默认是 0
m13number0第二行第四列,默认是 0
m20number0第三行第一列,默认是 0
m21number0第三行第二列,默认是 0
m22number1第三行第三列,默认是 1
m23number0第三行第四列,默认是 0
m30number0第四行第一列,默认是 0
m31number0第四行第二列,默认是 0
m32number0第四行第三列,默认是 0
m33number1第四行第四列,默认是 1

Returns

ProjectionMatrix

Inherited from

Matrix4.constructor

Defined in

src/math/Matrix4.ts:77

Properties

elements

elements: Float32Array | Float64Array

Inherited from

Matrix4.elements

Defined in

src/math/Matrix4.ts:57

Accessors

x

get x(): number

获取向量 x 值

Returns

number

number;

Inherited from

Matrix4.x

Defined in

src/math/Matrix4.ts:123


y

get y(): number

获取向量 y 值

Returns

number

number;

Inherited from

Matrix4.y

Defined in

src/math/Matrix4.ts:131


z

get z(): number

获取向量 z 值

Returns

number

number;

Inherited from

Matrix4.z

Defined in

src/math/Matrix4.ts:139


w

get w(): number

获取向量 w 值

Returns

number

number;

Inherited from

Matrix4.w

Defined in

src/math/Matrix4.ts:147


identity

get identity(): Matrix4

获取单位矩阵

Returns

Matrix4

Inherited from

Matrix4.identity

Defined in

src/math/Matrix4.ts:154

Methods

fromArray

fromArray(array, offset?): ProjectionMatrix

从数组构建矩阵

Parameters

NameTypeDefault valueDescription
arrayanyundefined原始数组
offsetnumber0数组偏移量

Returns

ProjectionMatrix

Inherited from

Matrix4.fromArray

Defined in

src/math/Matrix.ts:15


toArray

toArray(out?, offset?): Float32Array | Float64Array | number[]

从矩阵转换到数组

Parameters

NameTypeDefault valueDescription
outFloat32Array | Float64Array | number[][]输出数据
offsetnumber0偏移量

Returns

Float32Array | Float64Array | number[]

Inherited from

Matrix4.toArray

Defined in

src/math/Matrix.ts:28


set

set(m00, m01, m02, m03, m10, m11, m12, m13, m20, m21, m22, m23, m30, m31, m32, m33): ProjectionMatrix

将此矩阵的每一项设置为给定的值

Parameters

NameType
m00any
m01any
m02any
m03any
m10any
m11any
m12any
m13any
m20any
m21any
m22any
m23any
m30any
m31any
m32any
m33any

Returns

ProjectionMatrix

Inherited from

Matrix4.set

Defined in

src/math/Matrix4.ts:177


transpose

transpose(): ProjectionMatrix

将此矩阵转换为转置矩阵

Returns

ProjectionMatrix

this

Inherited from

Matrix4.transpose

Defined in

src/math/Matrix4.ts:186


invert

invert(m?): ProjectionMatrix

将此矩阵转换为逆矩阵

Parameters

NameTypeDescription
mProjectionMatrix默认为当前实例

Returns

ProjectionMatrix

Matrix4

Inherited from

Matrix4.invert

Defined in

src/math/Matrix4.ts:196


adjoint

adjoint(m?): ProjectionMatrix

计算此矩阵的伴随矩阵

Parameters

NameTypeDescription
mProjectionMatrix默认为当前实例

Returns

ProjectionMatrix

Inherited from

Matrix4.adjoint

Defined in

src/math/Matrix4.ts:205


determinant

determinant(): any

计算行列式

Returns

any

Inherited from

Matrix4.determinant

Defined in

src/math/Matrix4.ts:214


add

add(a, b?): ProjectionMatrix

将两个 Matrix4 矩阵相加

Parameters

NameTypeDescription
aMatrix4
b?Matrix4如果不传,计算 this 和 a 的和

Returns

ProjectionMatrix

this

Inherited from

Matrix4.add

Defined in

src/math/Matrix4.ts:224


subtract

subtract(a, b?): ProjectionMatrix

将两个 Matrix4 矩阵相减

Parameters

NameTypeDescription
aMatrix4
b?Matrix4如果不传,计算 this 和 a 的差

Returns

ProjectionMatrix

this

Inherited from

Matrix4.subtract

Defined in

src/math/Matrix4.ts:240


multiply

multiply(a, b?): ProjectionMatrix

计算两个 Matrix4 矩阵的乘积

Parameters

NameTypeDescription
aMatrix4
b?Matrix4如果不传,计算 this 和 a 的乘积

Returns

ProjectionMatrix

this

Inherited from

Matrix4.multiply

Defined in

src/math/Matrix4.ts:255


multiplyScalar

multiplyScalar(a?, b?): ProjectionMatrix

计算 Matrix4 与标量的乘积

Parameters

NameTypeDescription
aMatrix4如果不传,计算 this 和 b 的乘积
b?number

Returns

ProjectionMatrix

Inherited from

Matrix4.multiplyScalar

Defined in

src/math/Matrix4.ts:269


premultiply

premultiply(a, b?): ProjectionMatrix

左乘

Parameters

NameTypeDescription
aMatrix4
b?Matrix4如果不传,计算 this 和 a 的左乘

Returns

ProjectionMatrix

this

Inherited from

Matrix4.premultiply

Defined in

src/math/Matrix4.ts:280


translate

translate(v): ProjectionMatrix

通过给定的向量 Vector3 平移此矩阵

Parameters

NameTypeDescription
vVector3向量

Returns

ProjectionMatrix

this

Inherited from

Matrix4.translate

Defined in

src/math/Matrix4.ts:294


rotate

rotate(rad): ProjectionMatrix

旋转此矩阵

Parameters

NameTypeDescription
radnumber弧度

Returns

ProjectionMatrix

this

Inherited from

Matrix4.rotate

Defined in

src/math/Matrix4.ts:304


scale

scale(vec3): ProjectionMatrix

通过给定的 Vector3 向量缩放此矩阵

Parameters

NameType
vec3Vector3

Returns

ProjectionMatrix

Inherited from

Matrix4.scale

Defined in

src/math/Matrix4.ts:313


scaleScalar

scaleScalar(s): ProjectionMatrix

通过标量 s 缩放此矩阵,默认在内部构建一个三维向量 [s, s, s]

Parameters

NameType
snumber

Returns

ProjectionMatrix

Inherited from

Matrix4.scaleScalar

Defined in

src/math/Matrix4.ts:322


fromTranslation

fromTranslation(vec): ProjectionMatrix

从平移向量创建矩阵

Parameters

NameType
vecVector3

Returns

ProjectionMatrix

Inherited from

Matrix4.fromTranslation

Defined in

src/math/Matrix4.ts:331


fromRotation

fromRotation(rad, axis): ProjectionMatrix

从给定轴和旋转角度创建矩阵

Parameters

NameTypeDescription
radnumber弧度
axisany

Returns

ProjectionMatrix

Inherited from

Matrix4.fromRotation

Defined in

src/math/Matrix4.ts:341


fromRotationX

fromRotationX(rad): ProjectionMatrix

从绕 X 轴的给定角度创建矩阵

Parameters

NameType
radnumber

Returns

ProjectionMatrix

Inherited from

Matrix4.fromRotationX

Defined in

src/math/Matrix4.ts:350


fromRotationY

fromRotationY(rad): ProjectionMatrix

从绕 Y 轴的给定角度创建矩阵

Parameters

NameType
radnumber

Returns

ProjectionMatrix

Inherited from

Matrix4.fromRotationY

Defined in

src/math/Matrix4.ts:359


fromRotationZ

fromRotationZ(rad): ProjectionMatrix

从绕 Z 轴的给定角度创建矩阵

Parameters

NameType
radany

Returns

ProjectionMatrix

Inherited from

Matrix4.fromRotationZ

Defined in

src/math/Matrix4.ts:368


fromScale

fromScale(vec): ProjectionMatrix

从缩放向量计算矩阵

Parameters

NameType
vecVector3

Returns

ProjectionMatrix

Inherited from

Matrix4.fromScale

Defined in

src/math/Matrix4.ts:377


fromRotationTranslation

fromRotationTranslation(quat, v): ProjectionMatrix

从平移向量和四元数计算矩阵

Parameters

NameType
quatQuaternion
vVector3

Returns

ProjectionMatrix

Inherited from

Matrix4.fromRotationTranslation

Defined in

src/math/Matrix4.ts:387


fromPerspective

fromPerspective(fov, aspect, near, far): ProjectionMatrix

创建一个透视投影矩阵

Parameters

NameType
fovany
aspectany
nearany
farany

Returns

ProjectionMatrix

Inherited from

Matrix4.fromPerspective

Defined in

src/math/Matrix4.ts:399


fromOrthogonal

fromOrthogonal(left, right, bottom, top, near, far): ProjectionMatrix

创建一个正交投影矩阵

Parameters

NameType
leftany
rightany
bottomany
topany
nearany
farany

Returns

ProjectionMatrix

Inherited from

Matrix4.fromOrthogonal

Defined in

src/math/Matrix4.ts:413


fromQuat

fromQuat(q): ProjectionMatrix

从给定的四元数计算矩阵

Parameters

NameType
qQuaternion

Returns

ProjectionMatrix

Inherited from

Matrix4.fromQuat

Defined in

src/math/Matrix4.ts:422


equals

equals(mat4): any

判断两个矩阵是否近似相等

Parameters

NameType
mat4any

Returns

any

Inherited from

Matrix4.equals

Defined in

src/math/Matrix4.ts:431


getRotation

getRotation(q?): Quaternion

获取旋转向量

Parameters

NameType
qQuaternion

Returns

Quaternion

Inherited from

Matrix4.getRotation

Defined in

src/math/Matrix4.ts:439


getScale

getScale(v?): Vector3

获取缩放向量

Parameters

NameType
vVector3

Returns

Vector3

Inherited from

Matrix4.getScale

Defined in

src/math/Matrix4.ts:449


getTranslation

getTranslation(v?): Vector3

获取平移向量

Parameters

NameType
vVector3

Returns

Vector3

Inherited from

Matrix4.getTranslation

Defined in

src/math/Matrix4.ts:459


rotateX

rotateX(rad): ProjectionMatrix

围绕 X 轴按给定弧度旋转矩阵

Parameters

NameType
radany

Returns

ProjectionMatrix

Inherited from

Matrix4.rotateX

Defined in

src/math/Matrix4.ts:469


rotateY

rotateY(rad): ProjectionMatrix

围绕 Y 轴按给定弧度旋转矩阵

Parameters

NameType
radany

Returns

ProjectionMatrix

Inherited from

Matrix4.rotateY

Defined in

src/math/Matrix4.ts:478


rotateZ

rotateZ(rad): ProjectionMatrix

围绕 Z 轴按给定弧度旋转矩阵

Parameters

NameType
radany

Returns

ProjectionMatrix

Inherited from

Matrix4.rotateZ

Defined in

src/math/Matrix4.ts:487


compose

compose(v, q, s): ProjectionMatrix

从四元数旋转、平移和缩放创建矩阵

Parameters

NameType
vVector3
qQuaternion
sVector3

Returns

ProjectionMatrix

Inherited from

Matrix4.compose

Defined in

src/math/Matrix4.ts:498


decompose

decompose(): Object

从矩阵转换到四元数、平移和缩放向量

Returns

Object

NameType
rotationQuaternion
scaleVector3
translationVector3

Inherited from

Matrix4.decompose

Defined in

src/math/Matrix4.ts:506


copy

copy(m): ProjectionMatrix

将传入的 Matrix4 复制到此矩阵

Parameters

NameTypeDescription
mMatrix4源矩阵

Returns

ProjectionMatrix

this

Inherited from

Matrix4.copy

Defined in

src/math/Matrix4.ts:519


clone

clone(): Matrix4

从此矩阵创建一个新的 4*4 矩阵

Returns

Matrix4

a new Matrix4

Inherited from

Matrix4.clone

Defined in

src/math/Matrix4.ts:528


frustum

frustum(mat4, left, right, top, bottom, near, far): ProjectionMatrix

一般用于生成相机的视椎体,用来做视椎剔除加速渲染

Parameters

NameType
mat4any
leftany
rightany
topany
bottomany
nearany
farany

Returns

ProjectionMatrix

Defined in

src/math/ProjectionMatrix.ts:17


orthographic

orthographic(left, right, top, bottom, near, far): ProjectionMatrix

生成平面相机投影矩阵

Parameters

NameType
leftany
rightany
topany
bottomany
nearany
farany

Returns

ProjectionMatrix

Defined in

src/math/ProjectionMatrix.ts:31


perspective

perspective(fovy, aspect, near, far): ProjectionMatrix

生成透视相机投影矩阵

Parameters

NameType
fovyany
aspectany
nearany
farany

Returns

ProjectionMatrix

Defined in

src/math/ProjectionMatrix.ts:43


lookAt

lookAt(eye, target?, up?): ProjectionMatrix

设置物体的朝向

Parameters

NameType
eyeany
targetVector3
upVector3

Returns

ProjectionMatrix

Defined in

src/math/ProjectionMatrix.ts:54


toString

toString(): string

转换为字符串

Returns

string

Overrides

Matrix4.toString

Defined in

src/math/ProjectionMatrix.ts:62