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

概述

Cylindrical.clone() 方法返回一个新的 Cylindrical 对象,该对象是当前对象的副本。

Cylindrical 对象表示一个圆柱体坐标系,由半径、仰角和方位角三个属性构成。

使用 clone() 方法,我们可以快速复制一个 Cylindrical 对象,而无需重新输入属性值。

语法

cylinder.clone()

返回值

返回一个新的 Cylindrical 对象,该对象是当前对象的副本。

示例

const cylinder1 = new THREE.Cylindrical(1, Math.PI/2, Math.PI/4);
const cylinder2 = cylinder1.clone();

console.log(cylinder1.radius); //output: 1
console.log(cylinder1.theta); //output: 1.5707963267948966
console.log(cylinder1.y); //output: 0.7071067811865476

console.log(cylinder2.radius); //output: 1
console.log(cylinder2.theta); //output: 1.5707963267948966
console.log(cylinder2.y); //output: 0.7071067811865476

在本示例中,我们使用 new THREE.Cylindrical(1, Math.PI/2, Math.PI/4) 创建一个新的 Cylindrical 对象,该对象的半径为 1,仰角为 π/2,方位角为 π/4。然后,我们使用 clone() 方法克隆了该对象,生成了一个新的 Cylindrical 对象 cylinder2,并打印输出两个对象的属性值。可以看到 cylinder1cylinder2 的属性值完全相同,说明 clone() 方法成功地复制了 cylinder1 对象。

注意事项

Cylindrical.clone() 方法不会修改当前对象,而是返回一个新的克隆对象。因此,原始对象的属性值保持不变。