Consistent tessellation

Say I have two distinct, solid 3D bodies (each is a separate TopoDS_Shape) that a share a surface. As a simple example, this could be two concentric spheres, where the outer sphere has a spherical "hole" in it where the inner sphere sits. I'd like to tessellate these shapes such that the shared boundary gets tessellated exactly the same. This way, when I pass the tessellated bodies off to a mesher or visualizer, they don't overlap in any way.

What's the right approach for this? I had hoped I could tessellate them both together, but the class BRepMesh_IncrementalMesh seems to only take a single TopoDS_Shape, not a compound shape. I feel like this must be fairly common and that I'm probably just thinking about it wrong. Should I instead be merging these bodies into one TopoDS_Shape, tessellating it, and somehow keeping track of the two underlying volumes? I should note that I need to keep track of the different shapes because each will need to be colored different in the visualizer.

Any help on how to approach this would be greatly appreciated!

gkv311 n's picture

Just put your shapes into a temporary TopoDS_Compound and go ahead.