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

Frustum.intersectsBox()

The Frustum.intersectsBox() method is used to determine whether or not a Box3 intersects with a Frustum. A Frustum is a six-faced view frustum that is used in computer graphics to define the visible volume of a perspective camera. The Box3 is a three-dimensional box that is used to define a region of space.

Syntax

Frustum.intersectsBox( box )

Parameters

  • box : The Box3 object to test for intersection against the Frustum.

Return Value

A Boolean value indicating whether or not the provided Box3 intersects with the Frustum.

Examples

Here's an example that demonstrates how to use Frustum.intersectsBox() to determine whether or not a Box3 intersects with a Frustum:

const frustum = new THREE.Frustum();
const camera = new THREE.PerspectiveCamera();
camera.updateMatrix();
camera.updateMatrixWorld();
frustum.setFromMatrix( new THREE.Matrix4().multiplyMatrices( camera.projectionMatrix, camera.matrixWorldInverse ) );

const box = new THREE.Box3( new THREE.Vector3( -1, -1, -1 ), new THREE.Vector3( 1, 1, 1 ) );

const intersects = frustum.intersectsBox( box );

In this example, a Frustum is created based on the current state of a PerspectiveCamera. A Box3 is also created with the dimensions (-1,-1,-1) to (1,1,1). Finally, Frustum.intersectsBox() is used to determine whether or not the Box3 intersects with the Frustum, and the result is stored in the intersects variable.

Remarks

The Frustum.intersectsBox() method can be used with any Box3 that needs to be tested against a Frustum. It can be used, for example, to determine whether or not a particular object is visible to a PerspectiveCamera in a three-dimensional scene.

It is important to note that the Frustum.intersectsBox() method performs a simple intersection test, and does not take into account any other factors that might affect visibility or culling. It is therefore recommended that developers use additional culling techniques, such as occlusion culling or distance-based culling, in conjunction with the Frustum.intersectsBox() method to achieve optimal performance in their applications.

Additional Resources