Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Union of touching polyhedra

Hi, I'm trying to do a union operation over multiple touching polyhedra into one but couldn't find how to achieve this with Sage. For example, how can I merge these two cubes and dissolve the interior face (the touching face):

# two cubes touching
cube_a = Polyhedron(vertices=[(0,0,0), (0,0,1), (0,1,0), (0,1,1), (1,0,0), (1,0,1), (1,1,0), (1,1,1)])
cube_b = Polyhedron(vertices=[(1,1/2,0), (1,1/2,1), (1,3/2,0), (1,3/2,1), (2,1/2,0), (2,1/2,1), (2,3/2,0), (2,3/2,1)])

# visualize
cube_a.plot() + cube_b.plot()

The polyhedra can be assumed all convex, and each touching pair share a polygon interface. I found polyhedron.intersection(other), but no polyhedron.union(other) or so. Any workaround I can do? Thanks in advance.

Union of touching polyhedra

Hi, I'm trying to do a union operation over multiple touching polyhedra into one but couldn't find how to achieve this with Sage. For example, how can I merge these two cubes and dissolve the interior face (the touching face):

# two cubes touching
cube_a = Polyhedron(vertices=[(0,0,0), (0,0,1), (0,1,0), (0,1,1), (1,0,0), (1,0,1), (1,1,0), (1,1,1)])
cube_b = Polyhedron(vertices=[(1,1/2,0), (1,1/2,1), (1,3/2,0), (1,3/2,1), (2,1/2,0), (2,1/2,1), (2,3/2,0), (2,3/2,1)])

# visualize
cube_a.plot() + cube_b.plot()

The polyhedra can be assumed all convex, and each touching pair share a polygon interface. I found polyhedron.intersection(other), but no polyhedron.union(other) or so. Any workaround I can do? Thanks in advance.