Skip to content

Commit

Permalink
fix Volume.to_2d()
Browse files Browse the repository at this point in the history
  • Loading branch information
schlegelp committed Nov 28, 2023
1 parent 4446977 commit 800b5ea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions navis/core/volumes.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,10 +592,10 @@ def add_edge(edges, edge_points, coords, i, j):
raise ValueError(f'Unable to parse "{ax}" view')

try:
from shapely.ops import cascaded_union, polygonize # type: ignore
from shapely.ops import unary_union, polygonize # type: ignore
import shapely.geometry as geometry # type: ignore
except ImportError:
raise ImportError('This function needs the shapely package.')
raise ImportError('This function needs the shapely>=1.8.0')

coords: np.ndarray

Expand All @@ -612,9 +612,9 @@ def add_edge(edges, edge_points, coords, i, j):
edges: set = set()
edge_points: list = []
# loop over triangles:
# ia, ib, ic = indices of corner points of the
# triangle
for ia, ib, ic in tri.vertices:
# ia, ib, ic = indices of corner points of the triangle
# Note that "vertices" property was renamed to "simplices"
for ia, ib, ic in getattr(tri, 'simplices', getattr(tri, 'vertices', [])):
pa: np.ndarray = coords[ia] # type: ignore
pb: np.ndarray = coords[ib] # type: ignore
pc: np.ndarray = coords[ic] # type: ignore
Expand All @@ -635,7 +635,7 @@ def add_edge(edges, edge_points, coords, i, j):

m = geometry.MultiLineString(edge_points)
triangles = list(polygonize(m))
concave_hull = cascaded_union(triangles)
concave_hull = unary_union(triangles)

# Try with current settings, if this is not successful, try again
# with lower alpha
Expand Down

0 comments on commit 800b5ea

Please sign in to comment.