Преглед изворни кода

better box3d calculation in boundary-helper

Alexander Rose пре 5 година
родитељ
комит
9c97fc258d
1 измењених фајлова са 5 додато и 2 уклоњено
  1. 5 2
      src/mol-math/geometry/boundary-helper.ts

+ 5 - 2
src/mol-math/geometry/boundary-helper.ts

@@ -77,9 +77,12 @@ export class BoundaryHelper {
     }
 
     getBox(box?: Box3D) {
-        // TODO can we get a tighter box from the extrema???
         if (!box) box = Box3D()
-        return Box3D.fromSphere3D(box, this.centroidHelper.getSphere())
+        Box3D.setEmpty(box)
+        for (let i = 0; i < this.extrema.length; i++) {
+            Box3D.add(box, this.extrema[i])
+        }
+        return box
     }
 
     reset() {