From Solid Graphics Wiki

Jump to: navigation, search

The CSGOperation.Union method retrieves Union result of CSG operation between two Shape class objects. The CSG operation must be created by calling the CSGOperation.Create method before the Union method is called.


bool CSGOperation.Union( Shape solid );
bool CSGOperation.Union( Shape solid, TriangleOriginInfo triangleOriginInfo );


solid [out]
triangle mesh of the Union 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 CSGOperation.Create method before retrieving the operation result using the Union 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