Texturing and compound shapes

I am using OCC to generate geometry, but am not using OCC's visualization system - I am triangulating it, converting it to my own mesh format, and rendering it myself.

So in that context, how can I handle texturing? The specific case I'm interested in is with regards to boolean operations, but I suspect that there's a more general answer.

My question specifically is, is it possible to determine, for each face of a boolean shape, which shape it originally came from?

For example - a box with a sphere cut out of it. Can I determine somehow which faces were originally part of the box (a flat side) and which were created as a result of the difference with the sphere (the curved part), so I can texture them differently? Is it possible to do this in a generic way for arbitrary boolean combinations?

Moritz Baecher's picture

I am looking for the same functionality. Not sure if OCC can do this. I came across another library called CARVE. It clams to be able to do fast and robust 3D booleans on textured meshes.

Forum supervisor's picture

Dear Matt,
Yes, you can determine it (if the used algorithm supports history of operations).
In case of Boolean it supports it. See corresponding methods like Modified(), Generated(), Deleted() of BRepAlgoAPI_BooleaOperation class.