# Concatenating polyhedra at their region of contact

Given two polyhedra(with triangulated faces), P1 and P2. I want to create a polyhedron P, which is the result of joining the two at their region of contact. With join I do not mean union but physically, it is more like welding P1 and P2, so if there is say a cylinder(P1) and a cube(P2) aligned on same axis with P1 partially out of P2, union operation will result in disappearance of the part of cylinder inside the cuboid but I want to preserve that region in P. In other words, P1 and P2 should be concatenated at their region of contact.

I would like to know if there is any practical algorithm for this? I think that it is more like computing overlay of P1 and P2 but I do not find any approach for the same in 3D.

• Maybe something like this Commented Sep 20, 2016 at 10:49
• Can you be more precise about how the polyhedra are represented?
– D.W.
Commented Sep 20, 2016 at 11:22
• @D.W. Please see, I have edited accordingly. Commented Sep 20, 2016 at 11:28

This algorithm inserts new vertices and edges in the region of intersection between $P1$ and $P2$ thereby a generating new polyhedron $P$ and evaluates boolean operators on $P$ by selecting/rejecting vertices and edges depending on the operator. For my problem, $P$ forms the solution.
Update: I have tested the tool referred above against my original problem, it successfully prevents self-intersection by inserting new vertices and edges at the region of contact between $P1$ and $P2$.