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

The Box3.set() method is used in the Three.js library to set the dimensions of a 3D bounding box. It is a member of the THREE.Box3 class, which represents an axis-aligned bounding box with minimum and maximum points.

Syntax

.set( min: Vector3, max: Vector3 ) : this

Parameters

  • min: The minimum point of the bounding box, defined as a THREE.Vector3 object.
  • max: The maximum point of the bounding box, defined as a THREE.Vector3 object.

Return Value

The set() method returns the modified Box3 object.

Description

The set() method is used to modify the minimum and maximum point coordinates of a Box3 object. This updates the dimensions of the bounding box and recalculates its center point and size.

If no parameters are provided to the set() method, the min and max points of the bounding box will default to (Infinity, Infinity, Infinity) and (-Infinity, -Infinity, -Infinity), respectively.

Examples

Creating a bounding box and updating its dimensions using Box3.set():

const boundingBox = new THREE.Box3();

const minPoint = new THREE.Vector3( -10, -10, -10 );
const maxPoint = new THREE.Vector3( 10, 10, 10 );

boundingBox.set( minPoint, maxPoint );

Notes

  • The min and max vectors can be modified individually using the Box3.min and Box3.max properties.
  • The Box3 class provides several other methods for updating and querying bounding box dimensions, including Box3.expandByPoint(), Box3.union(), and Box3.intersectsBox().

Reference