how to do union operation over touching polyhedra

29 views
Skip to first unread message

Zhaiyu

unread,
Feb 19, 2021, 6:39:18 AM2/19/21
to sage-support
Dear members,

I'm trying to do boolean 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.

Best, Zhaiyu

Dima Pasechnik

unread,
Feb 19, 2021, 8:14:55 AM2/19/21
to sage-support
The union will in general be non-convex, and Sage doesn't handle
non-convex polyhedra.
The best you can hope for is to construct the convex closure.

E.g. for polytopes (specified by vertices) just take the polytope spanned by the
union of the vertices.
> --
> You received this message because you are subscribed to the Google Groups "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sage-support...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sage-support/ef9f99f3-921a-4743-aaa9-6d62aed6e385n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages