For all issues regarding the Forums use, please, refer to the Forum Rules.

Our Solutions

Need professional assistance?
Consider our:

Support Offerings

 

Need to speed up your development?
Have a look at our:

Samples & Tools

 

Need some functionality extending standard OCCT capabilities?
Check out our:

Adv. Components

Related pages

Question about collision detection

Marco Balen's picture
Forums: 

Hello all,

I have some question about the usage of the collision detection with BRepExtrema_ShapeProximity()

I can use only shapes that have brep data (loaded from iges or step or internally built) and that can be triangulated with BRepMesh_IncrementalMesh().

If the shape don't have the triangulation done, BRepExtrema_ShapeProximity() crashes ! 

1) In that case, how can I check if the shape has been already triangulated ? This to avoid to re-mesh the shape if it is not required.

2) How can I check if the shape after BRepMesh_IncrementalMesh() is a valid shape for BRepExtrema_ShapeProximity() ? This to avoid the crash.

3) Is there a method to use triangulated shapes, built with Poly_Triangulation as files stl ?

I think that the shape loaded with  Poly_Triangulation have the necessary triangulation for BRepExtrema_ShapeProximity, but it crashes

How can I solve this ?

Kirill Gavrilov's picture

> If the shape don't have the triangulation done, BRepExtrema_ShapeProximity() crashes ! 

Algorithm might return failed status, throw exception on invalid parameters, but not to "crash".
If you experience a crash - it is a good reason reporting an issue, with necessary reproduction steps, of course:
https://dev.opencascade.org/index.php?q=home/get_involved

> 1) In that case, how can I check if the shape has been already triangulated ? This to avoid to re-mesh the shape if it is not required.

BRepTools::Triangulation().

> 2) How can I check if the shape after BRepMesh_IncrementalMesh() is a valid shape for BRepExtrema_ShapeProximity() ? This to avoid the crash.

BRepMesh_IncrementalMesh can fail on invalid geometry (or fail due bugs in algorithm), in which case some faces within the given shape might have a NULL triangulation.