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-alpha08
fun fromCenterAndHalfExtents(center: Vector3, halfExtents: FloatSize3d): BoundingBox

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

Parameters
center: Vector3

The center point of the box.

halfExtents: FloatSize3d

The distance from the center to each face of the box. Each component must be greater than or equal to zero.

Returns
BoundingBox

A new BoundingBox instance.

Throws
kotlin.IllegalArgumentException

if any component of halfExtents is not greater than or equal to 0.

fromMinMax

Added in 1.0.0-alpha08
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 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).

max: Vector3

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

Returns
BoundingBox

A new BoundingBox instance.

Throws
kotlin.IllegalArgumentException

if any component of max is not greater than the corresponding component of min.

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-alpha08
val centerVector3

The center point of the box.

halfExtents

Added in 1.0.0-alpha08
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-alpha08
val maxVector3

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

min

Added in 1.0.0-alpha08
val minVector3

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