@@ -63,9 +63,10 @@ def write_feat_surfs(
6363 logger .warning ("{featurename} is not in the model, skipping" )
6464 return False , []
6565 has_feats = True
66- x = np .linspace (model .bounding_box [0 , 0 ], model .bounding_box [1 , 0 ], model .nsteps [0 ])
67- y = np .linspace (model .bounding_box [0 , 1 ], model .bounding_box [1 , 1 ], model .nsteps [1 ])
68- z = np .linspace (model .bounding_box [1 , 2 ], model .bounding_box [0 , 2 ], model .nsteps [2 ])
66+
67+ x = np .linspace (model .bounding_box .bb [0 , 0 ], model .bounding_box .bb [1 , 0 ], model .nsteps [0 ])
68+ y = np .linspace (model .bounding_box .bb [0 , 1 ], model .bounding_box .bb [1 , 1 ], model .nsteps [1 ])
69+ z = np .linspace (model .bounding_box .bb [1 , 2 ], model .bounding_box .bb [0 , 2 ], model .nsteps [2 ])
6970 xx , yy , zz = np .meshgrid (x , y , z , indexing = "ij" )
7071 points = np .array ([xx .flatten (), yy .flatten (), zz .flatten ()]).T
7172 val = model [featurename ].evaluate_value (points )
@@ -83,9 +84,9 @@ def write_feat_surfs(
8384 )
8485 verts += np .array (
8586 [
86- model .bounding_box [0 , 0 ],
87- model .bounding_box [0 , 1 ],
88- model .bounding_box [1 , 2 ],
87+ model .bounding_box . bb [0 , 0 ],
88+ model .bounding_box . bb [0 , 1 ],
89+ model .bounding_box . bb [1 , 2 ],
8990 ]
9091 )
9192 model .rescale (verts )
@@ -419,14 +420,7 @@ def _write_vol_evtk(model, file_name, data_label, nsteps, real_coords=True):
419420
420421 """
421422 # Define grid spacing
422- loop_X = np .linspace (model .bounding_box [0 , 0 ], model .bounding_box [1 , 0 ], nsteps [0 ])
423- loop_Y = np .linspace (model .bounding_box [0 , 1 ], model .bounding_box [1 , 1 ], nsteps [1 ])
424- loop_Z = np .linspace (model .bounding_box [0 , 2 ], model .bounding_box [1 , 2 ], nsteps [2 ])
425-
426- # Generate model values in 3d grid
427- xx , yy , zz = np .meshgrid (loop_X , loop_Y , loop_Z , indexing = "ij" )
428- # xyz is N x 3 vector array
429- xyz = np .array ([xx .flatten (), yy .flatten (), zz .flatten ()]).T
423+ xyz = model .bounding_box .regular_grid (nsteps )
430424 vals = model .evaluate_model (xyz , scale = False )
431425 if real_coords :
432426 model .rescale (xyz )
@@ -468,14 +462,8 @@ def _write_vol_gocad(model, file_name, data_label, nsteps, real_coords=True):
468462
469463 """
470464 # Define grid spacing in model scale coords
471- loop_X = np .linspace (model .bounding_box [0 , 0 ], model .bounding_box [1 , 0 ], nsteps [0 ])
472- loop_Y = np .linspace (model .bounding_box [0 , 1 ], model .bounding_box [1 , 1 ], nsteps [1 ])
473- loop_Z = np .linspace (model .bounding_box [0 , 2 ], model .bounding_box [1 , 2 ], nsteps [2 ])
474-
475- # Generate model values in 3d grid
476- xx , yy , zz = np .meshgrid (loop_X , loop_Y , loop_Z , indexing = "ij" )
477- # xyz is N x 3 vector array
478- xyz = np .array ([xx .flatten (), yy .flatten (), zz .flatten ()]).T
465+ xyz = model .bounding_box .regular_grid (nsteps )
466+
479467 vals = model .evaluate_model (xyz , scale = False )
480468 # Use FORTRAN style indexing for GOCAD VOXET
481469 vol_vals = np .reshape (vals , nsteps , order = "F" )
0 commit comments