Skip to content

Commit 5425e69

Browse files
committed
get_bounding_box must already be available before update call
1 parent ce8ac62 commit 5425e69

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

ngsolve_webgpu/geometry.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,15 +216,16 @@ def __init__(self, geo, label="Geometry"):
216216

217217
def update(self, options: RenderOptions):
218218
vis_data = self.geo._visualizationData()
219-
self.bounding_box = (vis_data["min"] + 1e-7, vis_data["max"] - 1e-7)
220219

221220
for ro in self.render_objects:
222221
ro.update(options, vis_data)
223222

224223
self.canvas = options.canvas
225224

226225
def get_bounding_box(self):
227-
return self.bounding_box
226+
pmin, pmax = self.geo.shape.bounding_box
227+
return ([pmin[0], pmin[1], pmin[2]],
228+
[pmax[0], pmax[1], pmax[2]])
228229

229230
def render(self, encoder):
230231
for r in self.render_objects:

ngsolve_webgpu/mesh.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,9 @@ def _create_data(self):
253253
self._last_mesh_timestamp = mesh._timestamp
254254

255255
def get_bounding_box(self):
256-
return (self.pmin, self.pmax)
256+
pmin, pmax = self.mesh.bounding_box
257+
return ([pmin[0], pmin[1], pmin[2]],
258+
[pmax[0], pmax[1], pmax[2]])
257259

258260
def get_buffers(self):
259261
for eltype in self.elements:

0 commit comments

Comments
 (0)