BoundingBox


public final class BoundingBox


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

Summary

Public methods

boolean
equals(Object other)
static final @NonNull BoundingBox
fromCenterAndHalfExtents(
    @NonNull Vector3 center,
    @NonNull FloatSize3d halfExtents
)

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

static final @NonNull BoundingBox

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

final @NonNull Vector3

The center point of the box.

final @NonNull FloatSize3d

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

final @NonNull Vector3

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

final @NonNull Vector3

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

int
@NonNull String

Public methods

equals

public boolean equals(Object other)

fromCenterAndHalfExtents

Added in 1.0.0-alpha08
public static final @NonNull BoundingBox fromCenterAndHalfExtents(
    @NonNull Vector3 center,
    @NonNull FloatSize3d halfExtents
)

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

Parameters
@NonNull Vector3 center

The center point of the box.

@NonNull FloatSize3d halfExtents

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

Returns
@NonNull 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
public static final @NonNull BoundingBox fromMinMax(@NonNull Vector3 min, @NonNull Vector3 max)

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
@NonNull Vector3 min

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

@NonNull Vector3 max

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

Returns
@NonNull BoundingBox

A new BoundingBox instance.

Throws
kotlin.IllegalArgumentException

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

getCenter

Added in 1.0.0-alpha08
public final @NonNull Vector3 getCenter()

The center point of the box.

getHalfExtents

Added in 1.0.0-alpha08
public final @NonNull FloatSize3d getHalfExtents()

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.

getMax

Added in 1.0.0-alpha08
public final @NonNull Vector3 getMax()

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

getMin

Added in 1.0.0-alpha08
public final @NonNull Vector3 getMin()

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

hashCode

public int hashCode()

toString

public @NonNull String toString()