How do I construct an OpenCascade `TopoDS_Shape` which is an identity element of `BRepAlgoAPI_Common`

108 views Asked by At

I'm trying to use OpenCascade's BRepAlgoAPI_Common and BRepAlgoAPI_Fuse as implementations of "intersection" and "union" operations for Constructive Solid Geometry (CSG). My solids are represented as instances of TopoDS_Shape (although I'm strictly interested in "Solid" values, so mainly TopoDS_Solid and TopoDS_CompSolid)

As far as simple operations on finite shapes goes, this is going pretty well.

However, because CSG operations form a Boolean Algebra, I'm interested in constructing identity values for the two CSG operations.

That is, a value everywhere for which intersection(x, everywhere) == x for all shapes, and a value nowhere for which union(x, nowhere) == x.

The documentation for BRepBuilderAPI_MakeSolid() states that

An empty solid is considered to cover the whole space

As such, I'd expect that I should be able to construct a value for everywhere, (the identity for intersection) by constructing a BRepBuilderAPI_MakeSolid, adding no shells to it, and building the result:

    auto everywhere = BRepBuilderAPI_MakeSolid().Shape();

However, if I experiment with this, it actually works as the identity for "union" (nowhere), and if I try and calculate the intersection of an object with everywhere (using BRepAlgoAPI_Common), I get an empty result.

Is it possible for me to construct a shape that will work as an identity for "intersection", and if so how?

0

There are 0 answers