Skip to content

Commit

Permalink
Isosurfaces now supports aligned surfaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricardo Serrano committed Mar 28, 2018
1 parent 6f70df2 commit 356cbcb
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions geomodelr/isosurfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,13 @@ def save_unit( name, model, unit, grid_divisions, bounded=True, filter_by_normal
the triangles that look down.
"""
assert MESH_AVAILABLE, "To be able to save units, you need the following packages installed: scipy, numpy-stl, scikit-image."
v, s = calculate_isosurface( model, unit, grid_divisions, bounded, filter_by_normal, normal_upwards, aligned )
v, s = calculate_isosurface( model, unit, grid_divisions, bounded, filter_by_normal, normal_upwards, aligned=False )
m = stl_mesh( v, s )
del v
del s
m.save(name)

def triangulate_unit( model, unit, grid_divisions, bounded=True, filter_by_normal=False, normal_upwards=False ):
def triangulate_unit( model, unit, grid_divisions, bounded=True, filter_by_normal=False, normal_upwards=False, aligned=False ):
"""
Triangulates a geological unit and returns it for further processing, (or saving it to the database).
It uses a marching cubes and a signed distance from the model.
Expand All @@ -311,7 +311,7 @@ def triangulate_unit( model, unit, grid_divisions, bounded=True, filter_by_norma
"""

assert MESH_AVAILABLE, "To be able to triangulate units, you need the following packages installed: scipy, numpy-stl, scikit-image."
vertices, triangles = calculate_isosurface( model, unit, grid_divisions, bounded, filter_by_normal, normal_upwards )
vertices, triangles = calculate_isosurface( model, unit, grid_divisions, bounded, filter_by_normal, normal_upwards, aligned )
m = stl_mesh( vertices, triangles )
volume, cog, inertia = m.get_mass_properties()
del m
Expand Down

0 comments on commit 356cbcb

Please sign in to comment.