physics collision by BRepExtrema_ShapeProximity


I make a simple physics collision detection demo based on the OCCT, using the class BRepExtrema_ShapeProximity for the collision shapes proximity. When the shapeProximity execute its function Perform() in the QT, i can get the right collision result. But when i move my test demo to the VisualStudio, the Perform is error,the collision detection is invalid. Anyone knows why the class has different result by different platform environment?

Kirill Gavrilov's picture

When the shapeProximity execute its function Perform() in the QT.
But when i move my test demo to the VisualStudio, the Perform is error

What do you mean "in the QT" and in Visual Studio?
What is the actual difference - is it the same project / the same OCCT build / the same Visual Studio compiler / the same release or debug configuration?

183715133_166659's picture

No, in the QT platform, the OCCT library is build with vs2017, while the VisualStudio platform  the OCCT is built with vs2019."In the QT" and the "Visual Studio" is the simple demo build and running software environment.

183715133_166659's picture

Hi Permalink,

I have make a test by the same OCCT build, it is the same result. when i build and run my demo in QT, the shapeProximity perform is well, while i move it to the Vs the perform is failed.

The function and code i use as the following:  

bool OccInter::isMeshCollised()


Standard_Boolean isDone = false;

TopoDS_Compound compoundIns;

BRep_Builder aBuilderIns;


aBuilderIns.Add(compoundIns, moveShapeIns);

TopoDS_Compound compoundIns2;

BRep_Builder aBuilderIns2;


aBuilderIns2.Add(compoundIns2, staticShapeIns);

//init shape proximity

BRepExtrema_ShapeProximity proximityIns(compoundIns, compoundIns2, 0.01);


TopoDS_Builder aComBuilder;

TopoDS_Compound collisFaceCompound;


if (proximityIns.IsDone())


BRepExtrema_MapOfIntegerPackedMapOfInteger::iterator anItl(proximityIns.OverlapSubShapes1().begin());

int index = 0;

for (; anItl !=proximityIns.OverlapSubShapes1().end(); anItl.operator++())


const TopoDS_Face& aFaceIns = proximityIns.GetSubShape1(index);

BRepExtrema_MapOfIntegerPackedMapOfInteger::iterator anItl2(proximityIns.OverlapSubShapes2().begin());

int sInd = 0;

for (;anItl2!=proximityIns.OverlapSubShapes2().end();anItl2.operator++())


const TopoDS_Face& aFaceIns2 = proximityIns.GetSubShape2(sInd);

TopoDS_Shape secShapeIns = BRepAlgoAPI_Common(aFaceIns, aFaceIns2);

if (!secShapeIns.IsNull() && isDone==0)


isDone = 1;

return true;


aComBuilder.Add(collisFaceCompound, secShapeIns);





return isDone;




std::cout << "Shape proximity perform failed." << std::endl;


return false;