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

Plane.distanceToSphere()

概述

Plane.distanceToSphere() 是用于计算平面和球体之间的距离的函数。它的实现基于 平面-球体相交的算法

语法

plane.distanceToSphere( sphere )

参数

  • sphere — 包含以下属性的对象:
    • center — 球心坐标.
    • radius — 球体半径.

返回值

返回平面和球体之间的距离。

示例

// 创建一个平面和球体
var plane = new THREE.Plane( new THREE.Vector3( 0, 1, 0 ), 0 );
var sphere = new THREE.Sphere( new THREE.Vector3( 0, 2, 0 ), 1 );

// 计算平面和球体之间的距离
var distance = plane.distanceToSphere( sphere );
console.log( distance ); // 输出 1

注意事项

  • Plane.distanceToSphere() 函数仅适用于平面和球体相交的情况。如果平面和球体不相交,函数的返回值将是负的球体半径。

参考文献

版本

  • THREE.R88

源码

https://github.com/mrdoob/three.js/blob/r88/src/math/Plane.js