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

Matrix4.makeRotationFromQuaternion()

概述

Matrix4.makeRotationFromQuaternion()three.jsMatrix4 类的一个方法,用于使用四元数创建一个旋转矩阵.

语法

Matrix4.makeRotationFromQuaternion( quaternion );

参数

  • quaternion : Quaternion - 创建旋转矩阵所需的四元数.

返回值

该方法没有直接的返回值,而是在调用的矩阵实例上应用旋转矩阵.

示例

const matrix = new THREE.Matrix4();

const quaternion = new THREE.Quaternion();
quaternion.setFromAxisAngle( new THREE.Vector3( 1, 0, 0 ), Math.PI / 2 );

matrix.makeRotationFromQuaternion( quaternion );

描述

该方法为矩阵实例创建一个旋转矩阵,用于将一个平面或物体绕一个指定的轴旋转.

四元数是一个用于描述三维空间旋转的数学对象,其使用 Quaternion.setFromAxisAngle() 创建,其将传递的轴矢量和旋转角度结合起来,以创建描述旋转的四元数.

这个旋转矩阵可以以后进行平移和缩放,并可以添加到场景中的对象中,以应用该旋转.

参考