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.set()

Frustum.set() is a method in the Three.js library that allows users to define the parameters of a frustum, or the portion of space in 3D that is visible on a 3D screen. This method takes in six parameters: left, right, bottom, top, near, and far, which are used to set the properties of the frustum.

Syntax

set(left: Number, right: Number, bottom: Number, top: Number, near: Number, far: Number): void

Parameters

  • left - The value of the left plane in the frustum. This value specifies the position of the frustum's left plane in relation to the origin and controls the horizontal view frustum.
  • right - The value of the right plane in the frustum. This value specifies the position of the frustum's right plane in relation to the origin and controls the horizontal view frustum.
  • bottom - The value of the bottom plane in the frustum. This value specifies the position of the frustum's bottom plane in relation to the origin and controls the vertical view frustum.
  • top - The value of the top plane in the frustum. This value specifies the position of the frustum's top plane in relation to the origin and controls the vertical view frustum.
  • near - The value of the near plane in the frustum. This value specifies the distance between the origin and the frustum's near plane, which controls how close objects can be before they are no longer visible.
  • far - The value of the far plane in the frustum. This value specifies the distance between the origin and the frustum's far plane, which controls how far away objects can be before they are no longer visible.

Return Value

This method does not return any value.

Example

const frustum = new THREE.Frustum();
const camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 ); 

// Set the properties of the frustum
frustum.set(-1, 1, -1, 1, camera.near, camera.far);

// Use the frustum to test if an object is inside the camera's view
if (frustum.intersectsObject(object)) {
  // Do something
}

In this example, we create a new frustum object and a perspective camera. We then use the set() method to define the properties of the frustum based on the camera's near and far values. Finally, we use the intersectsObject() method to check if an object is inside the frustum and do something with it if it is.