BufferGeometry
Object3D
Raycaster
Camera
CubeCamera
PerspectiveCamera
OrthographicCamera
StereoCamera
Clock
Curve
CurvePath
Path
Shape
ShapePath
ArrowHelper
AxesHelper
BoxHelper
Box3Helper
CameraHelper
DirectionalLightHelper
GridHelper
PolarGridHelper
HemisphereLightHelper
PlaneHelper
PointLightHelper
SkeletonHelper
SpotLightHelper
Light
PointLight
RectAreaLight
SpotLight
DirectionalLight
HemisphereLight
LightShadow
PointLightShadow
AnimationLoader
AudioLoader
BufferGeometryLoader
CompressedTextureLoader
CubeTextureLoader
DataTextureLoader
FileLoader
ImageBitmapLoader
ImageLoader
Loader
LoaderUtils
MaterialLoader
ObjectLoader
TextureLoader
LoadingManager
Material
Box2
Box3
Color
Cylindrical
Euler
Frustum
Interpolant
Line3
MathUtils
Matrix3
Matrix4
Plane
Quaternion
AnimationAction
AnimationClip
AnimationMixer
AnimationObjectGroup
AnimationUtils
keyframeTrack
PropertyBinding
PropertyMixer
BooleanKeyframeTrack
QuaternionKeyframeTrack
StringKeyframeTrack
Audio
AudioAnalyser
AudioContext
AudioListener
PositionalAudio

Matrix3.multiply()

Matrix3.multiply() 是three.js中的一个方法,用于计算矩阵乘积并将结果存储在当前矩阵对象上。

语法

matrix3.multiply(matrix)

参数

  • matrixMatrix3 类型的矩阵对象,被用来和当前矩阵对象计算矩阵乘积。

描述

矩阵乘积是将两个矩阵 A 和 B 相乘的运算,结果是一个新矩阵 C。在three.js中,使用 Matrix3.multiply() 方法可以在当前矩阵对象上计算矩阵乘积。

由于three.js内部使用列主序(column-major order)的矩阵来处理变换,因此当把两个矩阵相乘时需要注意操作顺序。在three.js中,矩阵 B 乘以矩阵 A 的运算应该写作 B.multiply(A),这与常规的数学符号 AB 是相反的。

示例

var A = new THREE.Matrix3().set(
  1, 2, 3,
  4, 5, 6,
  7, 8, 9
);

var B = new THREE.Matrix3().set(
  9, 8, 7,
  6, 5, 4,
  3, 2, 1
);

A.multiply(B);

console.log(A.elements); // [30, 24, 18, 84, 69, 54, 138, 114, 90]

在这个例子中,我们首先创建了两个矩阵 A 和 B,然后将它们相乘并将结果存储在矩阵 A 中。最后,我们输出了矩阵 A 的元素。

Matrix3.multiply()

Matrix3.multiply() is a method in three.js that calculates the matrix product and stores the result in the current matrix object.

Syntax

matrix3.multiply(matrix)

Parameters

  • matrix: A Matrix3 object. It is used to compute the matrix product with the current matrix object.

Description

The matrix product is the operation of multiplying two matrices A and B, resulting in a new matrix C. In three.js, the Matrix3.multiply() method is used to calculate the matrix product on the current matrix object.

Since three.js uses matrices in column-major order to handle transformations, it is important to be mindful of the order of operations when multiplying two matrices. In three.js, the operation B multiplied by A is written as B.multiply(A), which is opposite to the typical mathematical notation AB.

Example

var A = new THREE.Matrix3().set(
  1, 2, 3,
  4, 5, 6,
  7, 8, 9
);

var B = new THREE.Matrix3().set(
  9, 8, 7,
  6, 5, 4,
  3, 2, 1
);

A.multiply(B);

console.log(A.elements); // [30, 24, 18, 84, 69, 54, 138, 114, 90]

In this example, we first create two matrices A and B, then multiply them and store the result in matrix A. Finally, we output the elements of matrix A.