该方法用于获取一个视窗和透视相机的世界空间中的边框范围内的最小半径的球体。
Box3.getBoundingSphere( sphere : Sphere ) : Sphere
Sphere
类型的实例,用于输出计算结果。sphere
输入参数,填充计算出的包围球。该方法通过获取Box3
的尺寸和中心点,计算出一个最小外切圆,并将最终结果存储到给定的Sphere
实例中。
const box = new THREE.Box3(
new THREE.Vector3(-1, -1, -1),
new THREE.Vector3(1, 1, 1)
);
const sphere = new THREE.Sphere();
const radius = box.getBoundingSphere(sphere).radius;
getBoundingSphere: function ( sphere ) {
const vector = new Vector3();
this.getCenter( sphere.center );
sphere.radius = this.getSize( vector ).length() * 0.5;
return sphere;
},