Coordinate Systems

The official Open CASCADE documentation doesn't mention reference frames very often. This makes it hard to get the full picture. The following descriptions are based on my experiences and - in that respect - represent theories how things ought to be to make sense, without actually having examined the relevant points in OCC source code.

What's the reference frame of a shape?

Shapes are positioned in a global coordinate system using the TopLoc_Location data structure. This data structure describes a sequence of linked coordinate systems. It does ''not'' include a reference to a specific reference frame. Therefore what the TopLoc_Location actually represents depends on how you came into posession of it, how it was created.

For instance, if you use TopoDS_Iterator to examine a tree of shapes, you have the option to cumulate Locations during your hike down the tree. But you can as well omit that. Cumulating Locations means that at each shape in the tree, TopoDS_Iterator is packing all relative transformations leading up to this shape into a TopLoc_Location object. The reference frame of this TopLoc_Location object is then the coordinate system of the uppermost shape you visited, which is normally the root of your shape hierarchy. If you - on the other hand - omit the cumulation of Locations, TopoDS_Iterator will hand over at each shape a TopLoc_Location object which contains nothing more than the relative transformation of the respective shape. Then the reference frame of this TopLoc_Location object is the shape's parent shape.

What's the reference frame of BRepBndLib-calculated Bounding Boxes?

If you calculate a bounding box (using BndLib) for a shape, the frame of reference is the shape's coordinate system.

What's the reference frame of Triangulations?

A shape's triangulation can have an extra TopLoc_Location. The frame of reference of this TopLoc_Location object is the shape's coordinate system. It's similiar as to a TopoDS_Face's surface, which can have an extra TopLoc_Location as well.