Skip to content

Commit

Permalink
fix and test #2266
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedh committed Aug 15, 2024
1 parent c209688 commit e410673
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 14 deletions.
5 changes: 1 addition & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@ COPY --chown=499 pyproject.toml /home/user/
USER user

# install trimesh into .local
# then delete any included test directories
# and remove Cython after all the building is complete
RUN pip install --user /home/user[easy] && \
find /home/user/.local -type d -name tests -prune -exec rm -rf {} \;
RUN pip install --user /home/user[easy]

####################################
### Build output image most things should run on
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ requires = ["setuptools >= 61.0", "wheel"]
[project]
name = "trimesh"
requires-python = ">=3.8"
version = "4.4.5"
version = "4.4.6"
authors = [{name = "Michael Dawson-Haggerty", email = "[email protected]"}]
license = {file = "LICENSE.md"}
description = "Import, export, process, analyze and view triangular meshes."
Expand Down
10 changes: 10 additions & 0 deletions tests/test_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,16 @@ def test_path_sweep(self):
mesh = g.trimesh.creation.sweep_polygon(poly, path_closed, engine=engine)
assert mesh.is_volume

def test_simple_watertight(self):
# create a simple polygon
polygon = g.Polygon(((0.0, 0.0), (0.0, 1.0), (1.0, 1.0), (1.0, 0.0), (0.0, 0.0)))

for engine in self.engines:
mesh = g.trimesh.creation.extrude_polygon(
polygon=polygon, height=1, engine=engine
)
assert mesh.is_volume

def test_annulus(self):
"""
Basic tests of annular cylinder creation
Expand Down
2 changes: 1 addition & 1 deletion trimesh/boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def union(
if check_volume and not all(m.is_volume for m in meshes):
raise ValueError("Not all meshes are volumes!")

return _engines[engine](meshes, operation="union", **kwargs)
return _engines[engine](meshes, operation="union", **kwargs)


def intersection(
Expand Down
6 changes: 4 additions & 2 deletions trimesh/creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -591,11 +591,13 @@ def triangulate_polygon(

# the outer ring is wound counter-clockwise
rings = [
np.array(polygon.exterior.coords)[:: (1 if polygon.exterior.is_ccw else -1)]
np.array(polygon.exterior.coords)[:: (1 if polygon.exterior.is_ccw else -1)][
:-1
]
]
# wind interiors
rings.extend(
np.array(b.coords)[:: (-1 if b.is_ccw else 1)] for b in polygon.interiors
np.array(b.coords)[:: (-1 if b.is_ccw else 1)][:-1] for b in polygon.interiors
)
faces = manifold3d.triangulate(rings)
vertices = np.vstack(rings)
Expand Down
8 changes: 2 additions & 6 deletions trimesh/scene/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -1325,17 +1325,13 @@ def split_scene(geometry, **kwargs):
scene: trimesh.Scene
"""
# already a scene, so return it
if util.is_instance_named(geometry, "Scene"):
if isinstance(geometry, Scene):
return geometry

# a list of things
if util.is_sequence(geometry):
metadata = {}
for g in geometry:
try:
metadata.update(g.metadata)
except BaseException:
continue
[metadata.update(getattr(g, "metadata", {})) for g in geometry]
return Scene(geometry, metadata=metadata)

# a single geometry so we are going to split
Expand Down

0 comments on commit e410673

Please sign in to comment.