From Solid Graphics Wiki

Revision as of 00:59, 26 September 2012 by Rgrof (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

The CSGOperationd::BMinusA method retrieves B minus A result of CSG operation between two Shape class objects. The CSG operation must be created by calling the CSGOperationd::Create method before the BMinusA method is called.


bool CSGOperationd::BMinusA( Shape & solid );
bool CSGOperationd::BMinusA( Shape & solid, TriangleOriginInfo & triangleOriginInfo );


solid [out]
triangle mesh of the B minus A result of the CSG operation
triangleOriginInfo [out]
array of identifiers which can be used to determine origins of result triangles returned in the shape parameter. A TriangleOriginInfo structure is returned for each triangle in the result and for each result triangle it can be used to determine whether the triangle came from CSG operation input shape A or B, and from which triangle of that shape.

Return Value

Method returns true in case of success and false in case of failure. In case of failure the result is undefined, even though in lot of cases the result visually seems correct. In most cases the reason for failure is that the SolidKit Library software is not able to adapt to imprecisions in floating point calculations on computer hardware (CPU). This is a limitation of the SolidKit library - see Support of Constructive Solid Geometry in the SolidKit Library for more information.

In cases where false is returned when retrieving CSG operation result, and such result will be used as input in subsequent CSG operation - then calculation of such subsequent CSG operation will most likely fail.


The CSG operation must be created by calling the CSGOperationd::Create method before retrieving the operation result using the BMinusA method.

The version of the method which does not return TriangleOriginInfo information also tries to reduce number of triangles in returned result shape by internally calling Shape::ReduceCoplanarTriangles method on the result shape before exiting the method.

See Also

Personal tools