Project a world-space :type:BoundingBox through the camera and
return the diagonal of the screen-space AABB in pixels.
Treats the bbox's 8 corners independently (works for both
perspective and orthographic projection without a closed-form
radius). NDC → pixels assumes the viewport size matches the
renderer canvas.
Near-plane saturation. Projects with an explicit homogeneous w (the
combined projectionMatrix * matrixWorldInverse, not THREE's
Vector3.project which divides by w unguarded). If any corner has
w <= W_EPSILON — i.e. the camera is inside or straddling the box — the
group fills the screen, so we return +Infinity to saturate the selector
to its finest level (pickChildWithHysteresis then picks the top index;
the value is never fed to finite arithmetic, so no NaN). This is the inverse
of the old behaviour, where a corner crossing behind the near plane
collapsed the diagonal and wrongly dropped to a coarse level on close
approach. Orthographic cameras keep w == 1 and so never saturate.
Project a world-space :type:
BoundingBoxthrough the camera and return the diagonal of the screen-space AABB in pixels.Treats the bbox's 8 corners independently (works for both perspective and orthographic projection without a closed-form radius). NDC → pixels assumes the viewport size matches the renderer canvas.
Near-plane saturation. Projects with an explicit homogeneous
w(the combinedprojectionMatrix * matrixWorldInverse, not THREE'sVector3.projectwhich divides bywunguarded). If any corner hasw <= W_EPSILON— i.e. the camera is inside or straddling the box — the group fills the screen, so we return+Infinityto saturate the selector to its finest level (pickChildWithHysteresisthen picks the top index; the value is never fed to finite arithmetic, so no NaN). This is the inverse of the old behaviour, where a corner crossing behind the near plane collapsed the diagonal and wrongly dropped to a coarse level on close approach. Orthographic cameras keepw == 1and so never saturate.Exported for unit testing.