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

◆ aabb() [2/2]

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 240 of file Morphology.hpp.

241{
242 if (pts.empty())
243 return AABB3D { .min = glm::vec3(0.0F), .max = glm::vec3(0.0F) };
244 constexpr float inf = std::numeric_limits<float>::max();
245 AABB3D box { .min = glm::vec3(inf), .max = glm::vec3(-inf) };
246 for (const auto& p : pts) {
247 const glm::vec3 q = static_cast<glm::vec3>(p.position);
248 box.min = glm::min(box.min, q);
249 box.max = glm::max(box.max, q);
250 }
251 return box;
252}
double q
Axis-aligned bounding box in 3D world space.
Definition Bounds.hpp:188

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