Skip to content

Commit

Permalink
Merge pull request #2298 from musicinmybrain/multiple-difference-engines
Browse files Browse the repository at this point in the history
Do test_multiple_difference with all engines
  • Loading branch information
mikedh authored Oct 17, 2024
2 parents 81fc599 + f5691e1 commit b96511e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions tests/test_boolean.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,21 @@ def test_multiple_difference():
spheres = [g.trimesh.creation.icosphere()]
spheres.extend(g.trimesh.creation.icosphere().apply_translation(c) for c in center)

# compute using meshes method
diff_base = spheres[0].difference(spheres[1:])
# compute using function call (should be identical)
diff_meth = g.trimesh.boolean.difference(spheres)
for engine, exists in engines:
if not exists:
g.log.warning("skipping boolean engine %s", engine)
continue

g.log.info("Testing multiple difference with engine %s", engine)

# compute using meshes method
diff_base = spheres[0].difference(spheres[1:], engine=engine)
# compute using function call (should be identical)
diff_meth = g.trimesh.boolean.difference(spheres, engine=engine)

# both methods should produce the same result
assert np.isclose(diff_base.volume, diff_meth.volume)
assert diff_base.volume < spheres[0].volume
# both methods should produce the same result
assert np.isclose(diff_base.volume, diff_meth.volume)
assert diff_base.volume < spheres[0].volume

# should have done the diff
assert np.allclose(diff_base.extents, [1.5, 1.5, 2.0], atol=1e-8)
# should have done the diff
assert np.allclose(diff_base.extents, [1.5, 1.5, 2.0], atol=1e-8)

0 comments on commit b96511e

Please sign in to comment.