Browse Source

fix problems with newly divided house model

David Rose 22 years ago
parent
commit
3d916a1ff3
1 changed files with 18 additions and 0 deletions
  1. 18 0
      direct/src/extensions/NodePathCollection-extensions.py

+ 18 - 0
direct/src/extensions/NodePathCollection-extensions.py

@@ -14,3 +14,21 @@
             for nodePathIndex in range(self.getNumPaths()):
             for nodePathIndex in range(self.getNumPaths()):
                 npList.append(self.getPath(nodePathIndex))
                 npList.append(self.getPath(nodePathIndex))
             return npList
             return npList
+
+    def getTightBounds(self):
+        import Point3
+        
+        if self.getNumPaths() == 0:
+            return (Point3.Point3(0), Point3.Point3(0))
+
+        v1, v2 = self.getPath(0).getTightBounds()
+        for i in range(1, self.getNumPaths()):
+            v1x, v2x = self.getPath(i).getTightBounds()
+            v1 = Point3.Point3(min(v1[0], v1x[0]),
+                               min(v1[1], v1x[1]),
+                               min(v1[2], v1x[2]))
+            v2 = Point3.Point3(max(v2[0], v2x[0]),
+                               max(v2[1], v2x[1]),
+                               max(v2[2], v2x[2]))
+        
+        return v1, v2