MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ aabb()

template<PositionCarrying T>
AABB3D MayaFlux::Kinesis::aabb ( std::span< T >  pts)
noexcept

Axis-aligned bounding box of a PositionCarrying span.

Returns AABB3D{zero, zero} for an empty span. No allocation; single linear pass.

Template Parameters
TAny type satisfying PositionCarrying.
Parameters
ptsNon-owning span of points.
Returns
Tightest AABB enclosing all positions in pts.

Definition at line 136 of file Morphology.hpp.

137{
138 if (pts.empty())
139 return AABB3D { .min = glm::vec3(0.0F), .max = glm::vec3(0.0F) };
140 constexpr float inf = std::numeric_limits<float>::max();
141 AABB3D box { .min = glm::vec3(inf), .max = glm::vec3(-inf) };
142 for (const auto& p : pts) {
143 const glm::vec3 q = static_cast<glm::vec3>(p.position);
144 box.min = glm::min(box.min, q);
145 box.max = glm::max(box.max, q);
146 }
147 return box;
148}
double q
Axis-aligned bounding box in 3D world space.
Definition Bounds.hpp:143

References MayaFlux::Kinesis::AABB3D::min, and q.