Detecting the Intersection of Two Bodies
The method
MbResultType InterferenceSolids(MbSolid & solid1,
MbSolid & solid2,
std::vector<MbCurveEdge*> * edges,
std::vector<ptrdiff_t> (*faceNumbers)[4])
evaluates the intersection of two bodies.
The method input parameters are:
solid1 is the first body,
solid2 is the second body,
edges are the body intersection edges (no edges is also a possible situation),
(*faceNumbers)[4] is the face number container (it can be empty).
The output parameters of the method are the intersection edges of solid1 and solid2 body faces and the numbers of intersecting faces (*faceNumbers)[4].
The method returns either rt_Intersect if the bodies intersect or rt_NoIntersect if the bodies do not intersect.
The method is declared in the cdet_bool.h file.
The method modifies the solid1 and solid2 body edges, so if you need to keep the bodies unchanged, then you should pass to the method the copies received using MbSolid::Duplicate(). The bodies are modified by cutting the edges of the bodies with intersection edges.
The returned value, rt_Intersect, means that the pair of bodies has some intersection volume or some contact area. The function returns rt_NoIntersect if the bodies have no intersection volume. The tangency at one point is not considered to be intersection as in this case intersection volume is zero.
If the pointer to the edges container is not NULL, then the solid1 and solid2 intersection edges will be added to the edges container.
If the pointer to the faceNumbers face number container is not NULL, then the numbers of the intersecting faces of the first and second body correspondingly will be added to faceNumbers[0] and faceNumbers[1]. Furthermore, the numbers of the contacting faces of the first and second body correspondingly will be added to faceNumbers[2] and faceNumbers[3].