Return origo for AABB::center if it is infinite
@@ -82,8 +82,12 @@ impl AxisAlignedBoundingBox {
/// Get the center of the bounding box.
///
pub fn center(&self) -> Vec3 {
+ if self.is_infinite() {
+ vec3(0.0, 0.0, 0.0)
+ } else {
0.5 * self.max + 0.5 * self.min
}
+ }
///
/// Get the size of the bounding box.
