99
1010from LoopStructural .interpolators import GeologicalInterpolator
1111from LoopStructural .utils import BoundingBox
12+ from LoopStructural .datatypes import Surface
1213
1314surface_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