GCubeSDK
©2026 FenixFox®Studios

Box3

Class representing an axis-aligned bounding box (AABB) in 3D space.
A Box3 represents a rectangular box in 3D space that is aligned with the world coordinate axes. It is defined by two Vector3 points: min (lower-left-back corner) and max (upper-right-front corner).

Methods

Box3()

Default constructor - creates an empty box

Box3(const Vector3& min, const Vector3& max)

Constructor with min and max vectors

min Lower boundary of the box (+∞, +∞, +∞)
max Upper boundary of the box (-∞, -∞, -∞)

Box3& set(const Vector3& min, const Vector3& max)

Sets the lower and upper boundaries of this box

min Vector3 representing the lower boundary
max Vector3 representing the upper boundary

Box3& setFromCenterAndSize(const Vector3& center, const Vector3& size)

Centers this box on center and sets its dimensions

center Desired center position of the box
size Desired x, y and z dimensions of the box

Box3& setFromPoints(const vector<Vector3>& points)

Sets the box to contain all points in the array

points Array of Vector3s that the box will contain

Box3& setFromArray(const f32* array, u32 count)

Sets the box to contain all data in the array

array Array of position data (x,y,z,x,y,z...)
count Number of elements in the array

Box3& clone() const

Returns a new Box3 with the same min and max as this one

Box3& copy(const Box3& box)

Copies the min and max from box to this box

box Box3 to copy from

Box3& makeEmpty()

Makes this box empty

bool isEmpty() const

Returns true if this box includes zero points within its bounds

Box3& expandByPoint(const Vector3& point)

Expands the boundaries of this box to include point

point Vector3 that should be included in the box

Box3& expandByVector(const Vector3& vector)

Expands this box by vector in all directions

vector Vector3 to expand the box by

Box3& expandByScalar(f32 scalar)

Expands each dimension of the box by scalar

scalar Distance to expand the box by

Box3& expandByObject(const Object3D& object, bool precise)

Expands the boundaries to include object and its children

object Object3D to expand the box by
precise Expand as little as necessary at expense of computation false

bool containsPoint(const Vector3& point) const

Returns true if the specified point lies within or on the boundaries

point Vector3 to check for inclusion

bool containsBox(const Box3& box) const

Returns true if this box includes the entirety of box

box Box3 to test for inclusion

Vector3& clampPoint(const Vector3& point, Vector3& target) const

Calculate the clamp point within the bounds of this box if needed

point Vector3 to clamp
target Result will be copied into this Vector3

f32 distanceToPoint(const Vector3& point) const

Returns the distance from any edge of this box to the specified point

point Vector3 to measure distance to

Box3& intersect(const Box3& box)

Computes the intersection of this and box

box Box to intersect with

Box3& unionBox(const Box3& box)

Computes the union of this box and box

box Box that will be unioned with this box

bool intersectsBox(const Box3& box) const

Determines whether or not this box intersects box

box Box to check for intersection against

bool intersectsSphere(const Sphere& sphere) const

Determines whether or not this box intersects sphere

sphere Sphere to check for intersection against

bool intersectsPlane(const Plane& plane) const

Determines whether or not this box intersects plane

plane Plane to check for intersection against

bool intersectsTriangle(const Triangle& triangle) const

Determines whether or not this box intersects triangle

triangle Triangle to check for intersection against

Box3& applyMatrix4(const Matrix4& matrix)

Transforms this Box3 with the supplied matrix

matrix Matrix4 to apply

Box3& translate(const Vector3& offset)

Adds offset to both the upper and lower bounds of this box

offset Direction and distance of offset

Vector3& getCenter(Vector3& target) const

Returns the center point of the box as a Vector3

target Result will be copied into this Vector3

Vector3& getSize(Vector3& target) const

Returns the width, height and depth of this box

target Result will be copied into this Vector3

Vector3& getParameter(const Vector3& point, Vector3& target) const

Returns a point as a proportion of this box's width, height and depth

point Vector3 to get parameter for
target Result will be copied into this Vector3

Sphere& getBoundingSphere(Sphere& target) const

Gets a Sphere that bounds the box

target Result will be copied into this Sphere

bool equals(const Box3& box) const

Returns true if this box and box share the same lower and upper bounds

box Box to compare with this one

bool operator==(const Box3& box) const

Checks if this box equals another

box Box to compare with

bool operator!=(const Box3& box) const

Checks if this box does not equal another

box Box to compare with

Properties

enabled bool Active/inactive
id u32 Unique identifier
isBox3 bool Read-only tag
max Vector3 Upper boundary of the box
min Vector3 Lower boundary of the box
name string Optional display name
uuid string UUID string
version u32 Bumps on change