Search code examples
collision-detectioncomputational-geometryopencascade

With OpenCascade, how to do a collision detection of 2 shapes fast?


With OpenCascade, how to do a collision detection of 2 shapes? There may be several ways. One is to calculate their intersection, and check the intersection results. Another way is to calculate their minimal distance. Which way is faster? Or any faster ways? Thanks a lot.


Solution

  • computing a minimal distance is quite an expensive operation on a brep data structure. OCC does supply a commercial option [1] for collision detection. your other options might be to use ODE or Bullit to perform the collision detection on the mesh representing the BRep. That's the approach we take in the PythonOCC project, see [2]

    [1] http://www.opencascade.org/support/products/coldet/

    [2] http://www.pythonocc.org/resources/dyn/cad-and-rigid-body-simulation/

    edit: recently, I've integrated the excellent FCL library [3] for the offline robotics software I'm developing. what makes it great is that it works fine with degenerate meshes, and you can compute perform mesh-to-mesh distances ( not possible with ODE ) very quickly. the python ( cython ) bindings are a work in progress [4] but stable and the python overhead is hardly noticeable, I can recommend this approach.

    [3] https://github.com/flexible-collision-library/fcl

    [4] https://github.com/neka-nat/python-fcl