NavMap
|
Axis-aligned bounding box. More...
#include <Geometry.hpp>
Public Member Functions | |
bool | contains_xy (const Vec3 &p, float z_eps) const |
2D containment test on XY with tolerance in Z. | |
bool | contains_xy_only (const Vec3 &p) const |
2D containment test on XY only (no Z check). | |
void | expand (const AABB &b) |
Expand the box to include another box b (component-wise union). | |
void | expand (const Vec3 &p) |
Expand the box to include a point p . | |
bool | intersects_ray (const Vec3 &o, const Vec3 &d, float tmax=1e30f) const |
Robust ray-box intersection (slabs method). | |
int | longest_axis () const |
Return the index of the longest axis (0=x, 1=y, 2=z). | |
Public Attributes | |
Vec3 | max |
Maximum corner (x_max, y_max, z_max). | |
Vec3 | min |
Minimum corner (x_min, y_min, z_min). | |
Axis-aligned bounding box.
Stores component-wise minima/maxima and provides helpers for:
bool contains_xy | ( | const Vec3 & | p, |
float | z_eps ) const |
2D containment test on XY with tolerance in Z.
Checks if point p
lies inside the XY rectangle and within a vertical band around [min.z, max.z] expanded by z_eps
.
p | Query point. |
z_eps | Extra vertical half-thickness tolerance. |
bool contains_xy_only | ( | const Vec3 & | p | ) | const |
2D containment test on XY only (no Z check).
p | Query point. |
void expand | ( | const AABB & | b | ) |
Expand the box to include another box b
(component-wise union).
b | Other AABB to merge. |
void expand | ( | const Vec3 & | p | ) |
Expand the box to include a point p
.
p | Point to merge into this AABB. |
Robust ray-box intersection (slabs method).
Intersects ray (o + t * d) against the box. Handles zero components in direction d
by checking slab containment on that axis.
int longest_axis | ( | ) | const |
Return the index of the longest axis (0=x, 1=y, 2=z).
Vec3 max |
Maximum corner (x_max, y_max, z_max).
Initialized to -inf.
Vec3 min |
Minimum corner (x_min, y_min, z_min).
Initialized to +inf.