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

Box3.equals()

描述

Box3.equals()是three.js中Box3类的一个方法,用于比较两个Box3对象是否相等。

Box3对象用于表示三维空间中的一个矩形立方体,其存储了一个包围盒的最小点和最大点。

如果两个Box3对象的最小点和最大点都相等,则它们被认为是相等的。

语法

Box3.equals(box: Box3): Boolean

参数

  • box : 必须,类型为Box3,表示要比较的另一个Box3对象。

返回值

返回值为Boolean类型,表示两个Box3对象是否相等。

示例

let box1 = new THREE.Box3(new THREE.Vector3(0, 0, 0), new THREE.Vector3(1, 1, 1));
let box2 = new THREE.Box3(new THREE.Vector3(0, 0, 0), new THREE.Vector3(1, 1, 1));
let box3 = new THREE.Box3(new THREE.Vector3(1, 1, 1), new THREE.Vector3(2, 2, 2));

box1.equals(box2); // true
box1.equals(box3); // false

注意事项

  • Box3.equals()方法比较的是最小点和最大点是否相等,而不是盒子的大小是否相等。因此,即使两个盒子的大小不同,它们的最小点和最大点相同时,它们也会被认为是相等的。

参考文献