Explorar o código

allow scales to zero for BoundingLines

David Rose %!s(int64=24) %!d(string=hai) anos
pai
achega
a16f99c74c
Modificáronse 1 ficheiros con 5 adicións e 1 borrados
  1. 5 1
      panda/src/mathutil/boundingLine.cxx

+ 5 - 1
panda/src/mathutil/boundingLine.cxx

@@ -43,7 +43,11 @@ xform(const LMatrix4f &mat) {
   if (!is_empty() && !is_infinite()) {
     _origin = _origin * mat;
     _vector = _vector * mat;
-    _vector.normalize();
+    if (!_vector.normalize()) {
+      // If we just scaled the line down to nothing, it becomes an
+      // empty volume.
+      _flags |= F_empty;
+    }
   }
 }