BoundingBox


class BoundingBox


Represents an axis-aligned bounding box in 3D space, defined by its minimum and maximum corner points.

Summary

Public companion functions

BoundingBox
fromCenterAndHalfExtents(center: Vector3, halfExtents: FloatSize3d)

Creates a BoundingBox from a center point and its half-extents.

BoundingBox
fromMinMax(min: Vector3, max: Vector3)

Creates a BoundingBox with the given minimum and maximum corner points.

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

Vector3

the center point of the box

FloatSize3d

the distance from the center to each face of the box along the axes.

Vector3

a Vector3 representing the maximum corner of the box (highest x, y, and z values)

Vector3

a Vector3 representing the minimum corner of the box (lowest x, y, and z values)

Public companion functions

fromCenterAndHalfExtents

Added in 1.0.0-alpha10
fun fromCenterAndHalfExtents(center: Vector3, halfExtents: FloatSize3d): BoundingBox

Creates a BoundingBox from a center point and its half-extents.

This factory method ensures that the created bounding box is valid by checking that all components of center and halfExtents are not NaN, and that each component of halfExtents is greater than or equal to zero.

Parameters
center: Vector3

the center point of the box. Its components must not be NaN

halfExtents: FloatSize3d

the distance from the center to each face of the box. Its components must not be NaN and must be greater than or equal to zero

Returns
BoundingBox

a new BoundingBox instance

Throws
IllegalArgumentException

if any component of center or halfExtents is NaN, or if any component of halfExtents is negative

fromMinMax

Added in 1.0.0-alpha10
fun fromMinMax(min: Vector3, max: Vector3): BoundingBox

Creates a BoundingBox with the given minimum and maximum corner points.

This factory method ensures that the created bounding box is valid by checking that all components of min and max are not NaN, and that each component of the min point is less than or equal to the corresponding component of the max point.

Parameters
min: Vector3

a Vector3 representing the minimum corner of the box (lowest x, y, and z values). Its components must not be NaN

max: Vector3

a Vector3 representing the maximum corner of the box (highest x, y, and z values). Its components must not be NaN

Returns
BoundingBox

a new BoundingBox instance

Throws
IllegalArgumentException

if any component of min or max is NaN, or if any component of min is greater than the corresponding component of max

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

center

Added in 1.0.0-alpha10
val centerVector3

the center point of the box

halfExtents

Added in 1.0.0-alpha10
val halfExtentsFloatSize3d

the distance from the center to each face of the box along the axes. The total width, height, and depth of the box are twice the half-extent values

max

Added in 1.0.0-alpha10
val maxVector3

a Vector3 representing the maximum corner of the box (highest x, y, and z values)

min

Added in 1.0.0-alpha10
val minVector3

a Vector3 representing the minimum corner of the box (lowest x, y, and z values)