Class: Gfx3BoundingBox
The `Gfx3BoundingBox` class represents a 3D bounding box and provides various methods for manipulating
and calculating properties of the box.
Constructors
- new Gfx3BoundingBox(min: vec3, max: vec3): Gfx3BoundingBox
The constructor.
- min: The minimum point of the bounding box.
- max: The maximum point of the bounding box.
Methods
- fromVertices(vertices, vertexStride: number): void
The "fromVertices" function takes an array of vertices and calculates the new minimum and maximum values.
- vertices: The `vertices` parameter is an array of numbers representing the coordinates of
the points of a shape. Each triplets of numbers represents the x, y and z coordinates of a point.
- vertexStride
- getCenter(): vec3
The "getCenter" function calculates the center point of the box.
- getPerimeter(): number
The "getPerimeter" function calculates and returns the perimeter of the box.
- getRadius(): number
The "getRadius" function calculates the radius of a circumscribed circle to the box.
- getSize(): vec3
The "getSize" function calculates and returns the width, height and depth of the box.
- getVolume(): number
The "getVolume" function calculates the volume of a the box.
- intersectBoundingBox(aabb: Gfx3BoundingBox): boolean
The "intersectBoundingBox" function checks if two bounding boxes intersect.
- aabb: The parameter "aabb" is the box to check for intersection.
- isPointInside(x: number, y: number, z: number): boolean
The "isPointInside" function checks if a given point is inside the box.
- x: The x-coordinate of the point.
- y: The y-coordinate of the point.
- z: The z-coordinate of the point.
- merge(aabb: Gfx3BoundingBox): Gfx3BoundingBox
The "merge" function takes a `Gfx3BoundingBox` object as input and returns a new `Gfx3BoundingBox`
that represents the union of the two boxes.
- aabb: The `aabb` parameter is the box to merge.
- reset(): void
The "reset" function sets the "min" and "max" values to [0, 0, 0].
- setMax(max: vec3): void
The "setMax" function sets the maximum value.
- max: The `max`point of the box.
- setMin(min: vec3): void
The "setMin" function sets the minimum value.
- min: The `min` point of the box.
- transform(matrix: mat4): Gfx3BoundingBox
The "transform" function takes a matrix and transforms the bounding box
points, returning a new transformed bounding box.
- matrix: The `matrix` parameter is a 4x4 transformation matrix. It is used to
transform the points of a bounding box.
- createFromCenter(x: number, y: number, z: number, w: number, h: number, d: number): Gfx3BoundingBox
The "createFromCenter" is a static method that creates a new instance of "Gfx3BoundingBox".
- x: The x-coordinate of the center of the bounding box.
- y: The y-coordinate of the center of the bounding box.
- z: The z-coordinate of the center of the bounding box.
- w: The width of the bounding box.
- h: The height of the bounding box.
- d: The depth of the bounding box.
- createFromCoord(x: number, y: number, z: number, w: number, h: number, d: number): Gfx3BoundingBox
The "createFromCoord" is a static method that creates a new instance of "Gfx3BoundingBox".
- x: The x-coordinate of the bottom-left-front corner of the bounding box.
- y: The y-coordinate of the bottom-left-front corner of the bounding box.
- z: The z-coordinate of the bottom-left-front corner of the bounding box.
- w: The width of the bounding box.
- h: The height of the bounding box.
- d: The depth of the bounding box.
- merge(aabbs: Gfx3BoundingBox[]): Gfx3BoundingBox
The "merge" function takes an array of `Gfx3BoundingBox` objects as input and returns a new `Gfx3BoundingBox`
that represents the union of boxes.
- aabbs: The `aabbs` parameter is an array of box to merge.