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

Cylindrical.setFromVector3()

该方法是three.js中一个Cylindrical类的方法,用于根据给定的向量设置一个圆柱体。

语法

.setFromVector3(vector3)

参数

  • vector3THREE.Vector3 - 要从中设置圆柱体的向量。

描述

该方法通过在以该向量为初始点、Z轴方向为该向量的单位向量,Y轴方向为向量与Z轴向量的叉积所构成的平面内找到一个半径为该向量的长度的圆柱体来设置该Cylindrical对象。

代码示例

// 使用Cylindrical.setFromVector3() 设置一个圆柱体
const vector = new THREE.Vector3(10, 20, 30);
const cylindrical = new THREE.Cylindrical().setFromVector3(vector);

console.log(cylindrical.radius); // 34.64101615137755
console.log(cylindrical.theta); // 1.1071487177940904
console.log(cylindrical.y); // 20

参考文献