# CSGOperation::Intersection

### From Solid Graphics Wiki

Rgrof (Talk | contribs)

(New page: The '''CSGOperationd::Intersection''' method retrieves Intersection result of CSG operation between two Shape class objects. The CSG operation must be created by calling the [[CSGO...)

Next diff →

## Current revision

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

## Syntax

**bool** **CSGOperationd::Intersection**( Shape & *solid* );

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

## Parameters

*solid*[out]

*triangleOriginInfo*[out]

*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.

## Remarks

The CSG operation must be created by calling the CSGOperationd::Create method before retrieving the operation result using the *Intersection* 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.