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.set()

The set() method of the Matrix3 class in the Three.js library sets the values of a 3x3 matrix.

Syntax

.set(n11, n12, n13, n21, n22, n23, n31, n32, n33)

Parameters

  • n11, n12, n13, n21, n22, n23, n31, n32, n33: Nine numbers representing the values to set for the 3x3 matrix.

Description

The set() method sets the values of the Matrix3 instance to the provided values. The values are expected to be provided in row-major order, meaning that the first three values (n11, n12, n13) correspond to the first row of the matrix, and so on.

Return Value

The set() method does not return a value, but modifies the calling Matrix3 instance.

Examples

const matrix = new THREE.Matrix3();
matrix.set(
  1, 0, 0,
  0, 1, 0,
  0, 0, 1
);
console.log(matrix);

Output:

Matrix3 {
  elements: [
    1, 0, 0,
    0, 1, 0,
    0, 0, 1
  ]
}

Remarks

  • The Matrix3 class is used to represent 3x3 matrices in Three.js. Such matrices are commonly used in computer graphics for affine transformations, such as rotation, scaling, and translation.
  • The set() method is commonly used to initialize a Matrix3 instance with a specific set of values. Another common approach is to use one of the convenience methods, such as makeRotationZ() or makeScale().

See Also