Skip to content

Commit 6f28d67

Browse files
committed
fix: return surface object from isosurfacer
1 parent 2102c72 commit 6f28d67

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

LoopStructural/api/_surface.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from LoopStructural.interpolators import GeologicalInterpolator
1111
from LoopStructural.utils import BoundingBox
12+
from LoopStructural.datatypes import Surface
1213

1314
surface_list = dict[str, tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]]
1415

@@ -20,17 +21,23 @@ def __init__(self, bounding_box: BoundingBox, interpolator: GeologicalInterpolat
2021

2122
def fit(self, values: Union[list, int, float]) -> surface_list:
2223
surfaces = {}
23-
all_values = self.interpolator.evaluate_value(self.bounding_box.regular_grid)
24+
all_values = self.interpolator.evaluate_value(self.bounding_box.regular_grid())
2425
if isinstance(values, list):
2526
isovalues = values
2627
elif isinstance(values, float):
2728
isovalues = [values]
2829
elif isinstance(values, int):
2930
isovalues = np.linspace(np.min(all_values), np.max(all_values), values)
3031
for isovalue in isovalues:
31-
surfaces[isovalue] = marching_cubes(
32+
verts, faces, normals, values = marching_cubes(
3233
all_values.reshape(self.bounding_box.nsteps, order="C"),
3334
isovalue,
3435
spacing=self.bounding_box.step_vector,
3536
)
37+
surfaces[f"surface_{isovalue}"] = Surface(
38+
vertices=verts,
39+
triangles=faces,
40+
normals=normals,
41+
name=f"surface_{isovalue}",
42+
)
3643
return surfaces

0 commit comments

Comments
 (0)