aabb
| Type | Struct |
| Namespace | conjure::math |
| Include File Path | engine/include/conjure/core/math/aabb.h |
| Source File Path | engine/src/core/math/aabb.cpp |
| API ↗ | Math |
Syntax
Variables
| Access | Name | Type | Default | Description |
|---|---|---|---|---|
| public | max | vec3 | vec3(-F32_MAX) | |
| public | min | vec3 | vec3(F32_MAX) |
Functions
Public
closest_point
closest_pointThe point inside or on the box nearest to point (point itself when inside). An invalid box has no surface and returns point unchanged.
contains
contains[[nodiscard]] bool contains(
vec3 point) const noexcept;True when the point lies inside or on the box. Always false for an invalid box.
[[nodiscard]] bool contains(
const aabb &other) const noexcept;True when other lies entirely inside or on this box. False when either box is invalid.
corners
corners[[nodiscard]] std::array<vec3, 8> corners() const noexcept;The eight corners, in the order min, +x, +y, +xy, +z, +xz, +yz, max (bit 0 = x at max, bit 1 = y at max, bit 2 = z at max).
distance_squared
distance_squaredSquared distance from point to the box surface, 0 when inside. 0 for an invalid box (like surface_area and volume).
expand
expandvoid expand(
vec3 point) noexcept;Grows the box to include a point.
void expand(
const aabb &other) noexcept;Grows the box to include another box. An invalid other box is ignored.
from_center_extents
from_center_extentsA box with the given center and half-size on each axis (negative extents are made positive).
from_points
from_pointsA box from two arbitrary corners (they need not be ordered).
inflated
inflatedGrows the box by amount on every side (shrinks for negative amounts).
intersection
intersectionThe overlap of both boxes; invalid when they do not intersect.
intersects
intersects[[nodiscard]] bool intersects(
const aabb &other) const noexcept;True when the boxes overlap or touch. False when either box is invalid.
is_valid
is_valid[[nodiscard]] bool is_valid() const noexcept;True when min <= max on every axis (a point or a degenerate flat box is valid).
surface_area
surface_area[[nodiscard]] f32 surface_area() const noexcept;Total area of the six faces; 0 for an invalid box.
transformed
transformedThe axis-aligned box enclosing all eight transformed corners (conservative under rotation). Affine matrices only: the bottom row is ignored (no perspective divide), so a projection matrix yields a meaningless box; use frustum::corners for view volumes. An invalid box stays invalid.