Skip to content

Commit

Permalink
check for Z in polygons
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedh committed Oct 26, 2018
1 parent e1d5af6 commit 842652a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 7 additions & 2 deletions trimesh/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ def extrude_triangulation(vertices,


def triangulate_polygon(polygon,
triangle_args='pq0D',
triangle_args='pq30',
engine='auto',
**kwargs):
"""
Expand Down Expand Up @@ -307,7 +307,7 @@ def triangulate_polygon(polygon,

# do the import here, as sometimes this import can segfault
# which is not catchable with a try/except block
import meshpy.triangle as triangle
from meshpy import triangle
# call meshpy.triangle on our cleaned representation of
# the Shapely polygon
info = triangle.MeshInfo()
Expand Down Expand Up @@ -403,6 +403,11 @@ def add_boundary(boundary, start):
vertices = np.vstack(vertices)
facets = np.vstack(facets).tolist()

# shapely polygons can include a Z component
# strip it out for the triangulation
if vertices.shape[1] == 3:
vertices = vertices[:, :2]

result = {'vertices': vertices,
'segments': facets}
# holes in meshpy lingo are a (h, 2) list of (x,y) points
Expand Down
2 changes: 1 addition & 1 deletion trimesh/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '2.35.12'
__version__ = '2.35.13'

0 comments on commit 842652a

Please sign in to comment.