Class BoundingBox
Implements
Constructors
constructor
-
new BoundingBox(
min: DeepImmutable<Vector3>,
max: DeepImmutable<Vector3>,
worldMatrix?: DeepImmutableObject<Matrix>,
): BoundingBoxCreates a new bounding box
Parameters
- min: DeepImmutable<Vector3>
defines the minimum vector (in local space)
- max: DeepImmutable<Vector3>
defines the maximum vector (in local space)
OptionalworldMatrix: DeepImmutableObject<Matrix>defines the new world matrix
Returns BoundingBox
- min: DeepImmutable<Vector3>
Properties
Readonlycenter
Gets the center of the bounding box in local space
Readonlycenter World
Gets the center of the bounding box in world space
Readonlydirections
Gets the OBB (object bounding box) directions
Readonlyextend Size
Gets half the size of the extent in local space. Multiply by 2 to obtain the full size of the box!
Readonlyextend Size World
Gets half the size of the extent in world space. Multiply by 2 to obtain the full size of the box!
Readonlymaximum
Gets the maximum vector in local space
Readonlymaximum World
Gets the maximum vector in world space
Readonlyminimum
Gets the minimum vector in local space
Readonlyminimum World
Gets the minimum vector in world space
Readonlyvectors
Gets the 8 vectors representing the bounding box in local space
Readonlyvectors World
Gets the 8 vectors representing the bounding box in world space
Methods
dispose
-
Disposes the resources of the class
Returns void
get World Matrix
intersects Min Max
-
Tests if the bounding box intersects with a box defined by a min and max vectors
Parameters
- min: DeepImmutable<Vector3>
defines the min vector to use
- max: DeepImmutable<Vector3>
defines the max vector to use
Returns boolean
true if there is an intersection
- min: DeepImmutable<Vector3>
intersects Point
-
Tests if a point is inside the bounding box
Parameters
- point: DeepImmutable<Vector3>
defines the point to test
Returns boolean
true if the point is inside the bounding box
- point: DeepImmutable<Vector3>
intersects Sphere
-
Tests if the bounding box intersects with a bounding sphere
Parameters
- sphere: DeepImmutable<BoundingSphere>
defines the sphere to test
Returns boolean
true if there is an intersection
- sphere: DeepImmutable<BoundingSphere>
is Completely In Frustum
-
Tests if the bounding box is entirely inside the frustum planes
Parameters
- frustumPlanes: DeepImmutableObject<Plane>[]
defines the frustum planes to test
Returns boolean
true if there is an inclusion
- frustumPlanes: DeepImmutableObject<Plane>[]
is In Frustum
-
Tests if the bounding box is intersecting the frustum planes
Parameters
- frustumPlanes: DeepImmutableObject<Plane>[]
defines the frustum planes to test
Returns boolean
true if there is an intersection
- frustumPlanes: DeepImmutableObject<Plane>[]
re Construct
-
reConstruct(
min: DeepImmutable<Vector3>,
max: DeepImmutable<Vector3>,
worldMatrix?: DeepImmutableObject<Matrix>,
): voidRecreates the entire bounding box from scratch as if we call the constructor in place
Parameters
- min: DeepImmutable<Vector3>
defines the new minimum vector (in local space)
- max: DeepImmutable<Vector3>
defines the new maximum vector (in local space)
OptionalworldMatrix: DeepImmutableObject<Matrix>defines the new world matrix
Returns void
- min: DeepImmutable<Vector3>
scale
-
Scale the current bounding box by applying a scale factor
Parameters
- factor: number
defines the scale factor to apply
Returns BoundingBox
the current bounding box
- factor: number
StaticIntersects
-
Tests if two bounding boxes are intersections
Parameters
- box0: DeepImmutable<BoundingBox>
defines the first box to test
- box1: DeepImmutable<BoundingBox>
defines the second box to test
Returns boolean
true if there is an intersection
- box0: DeepImmutable<BoundingBox>
StaticIntersects Sphere
-
IntersectsSphere(
minPoint: DeepImmutable<Vector3>,
maxPoint: DeepImmutable<Vector3>,
sphereCenter: DeepImmutable<Vector3>,
sphereRadius: number,
): booleanTests if a bounding box defines by a min/max vectors intersects a sphere
Parameters
- minPoint: DeepImmutable<Vector3>
defines the minimum vector of the bounding box
- maxPoint: DeepImmutable<Vector3>
defines the maximum vector of the bounding box
- sphereCenter: DeepImmutable<Vector3>
defines the sphere center
- sphereRadius: number
defines the sphere radius
Returns boolean
true if there is an intersection
- minPoint: DeepImmutable<Vector3>
StaticIs Completely In Frustum
-
IsCompletelyInFrustum(
boundingVectors: DeepImmutableObject<Vector3>[],
frustumPlanes: DeepImmutableObject<Plane>[],
): booleanTests if a bounding box defined with 8 vectors is entirely inside frustum planes
Parameters
- boundingVectors: DeepImmutableObject<Vector3>[]
defines an array of 8 vectors representing a bounding box
- frustumPlanes: DeepImmutableObject<Plane>[]
defines the frustum planes to test
Returns boolean
true if there is an inclusion
- boundingVectors: DeepImmutableObject<Vector3>[]
StaticIs In Frustum
-
IsInFrustum(
boundingVectors: DeepImmutableObject<Vector3>[],
frustumPlanes: DeepImmutableObject<Plane>[],
): booleanTests if a bounding box defined with 8 vectors intersects frustum planes
Parameters
- boundingVectors: DeepImmutableObject<Vector3>[]
defines an array of 8 vectors representing a bounding box
- frustumPlanes: DeepImmutableObject<Plane>[]
defines the frustum planes to test
Returns boolean
true if there is an intersection
- boundingVectors: DeepImmutableObject<Vector3>[]
Class used to store bounding box information