BoundingSphere.clone()
方法用于克隆一个 BoundingSphere
对象。
clone(): BoundingSphere
BoundingSphere
克隆出来的 BoundingSphere
对象。const sphere = new THREE.Sphere(new THREE.Vector3(1, 2, 3), 4);
const clonedSphere = sphere.clone();
console.log(clonedSphere);
输出结果:
Sphere {
center: Vector3 { x: 1, y: 2, z: 3 },
radius: 4
}
BoundingSphere.clone()
方法通过使用一个已有的 BoundingSphere
对象的参数值来创建一个新的 BoundingSphere
对象来实现克隆操作。由于 BoundingSphere
对象是基于 Sphere
对象实现的,因此在克隆时也需要同时克隆 Sphere
对象的属性。
BoundingSphere
对象在暴露 clone()
方法之前必须已经初始化,否则会抛出 TypeError
异常。