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

Please, give any advice about solids collision detection

Anonymous's picture
Forums: 

I have some (about 10-30) solids of not so complex shape, and when i move one, it must stop when colliding with other(s). Please, give any advice about solving this problem in OpenCASCADE, or at least, a fast way to find if two solids have a common part?

Stephane Routelous's picture

Hi Dimitri,

If you want to compute collision detection with OCC, it will be quite slow.
Specially if you are using the boolean operations.

You can make an algorothm like that :
compute the bouding boxes ( Bnd_Box )of you shapes ( with BRepBndLib ).
Compute the intersections of the boxes ( see the methods of Bnd_Box in Bnd_Box.cdl ).

The problem is that the bounding boxes are bigger than the shapes ( for example, if you have 2 spheres S1(C1(0,0,0),R(1)) S2(C2(1,1,1),R2(0.1)) the Bnd_Box are intersecting, but not the shapes ).

You can refine your tests if you compute voxels for the shapes.
A voxel is a little Bnd_Box, and a shape is composed with a lot of voxels. To compute the voxels of a shape, extract the triangles from the triangulation of the shape and create some boxes with predefined size ( dx,dy,dz ) "enclosing" your triangulation.
The voxelisation of the shape is more accurate than the Bnd_Box, but not the exact representation.

If the voxels of one shape intersect the voxels of another, you HAVE TO work with boolean operations to be sure of the intersection.
The question is how accurate you want to be.
You can also write your own algorithm to work with the triangulation, instead with the topological shapes. But be aware, it can also be slower than the boolean operations.

Perhaps in you read the code for the boolean operations, and extract low-level preprocessing code ( if any ), you will find a way to have a fast test.

In conclusion, if you want to have the exact computation, it will be slow, if not, you can use the Bnd_Box or voxels and it will be quite fast.

Good Luck.

Stephane
http://www.exotk.org

Dmitriy Scherbakov's picture

Thank you very much for answer. I'll think about it.

Roman Lygin's picture

Dear all,

At Open CASCADE we have got an advanced component capable of collision and proximity detection, which is not a part of open source.

I have already communicated to Dmitriy on this issue. If anyone of you is interested in getting further information on this subject, please feel free to contact me directly, I will be pleased to help you.

Yours faithfully,
Roman

--
Roman Lygin - Pre-sales and qualification manager
Open CASCADE S.A.
email: r-lygin@opencascade.com
http://www.opencascade.com
Open CASCADE, the Open Source Standard for 3D modeling solutions

Tom's picture

Hi, I want some information about collision and proximity detection, Thank you!

Forum supervisor's picture

Hi Tom,

Please have a look at the Collision Detection component described at http://www.opencascade.org/support/products/coldet/.

Please do not hesitate to contact us for more information!
Best regards,
Forum Supervisor

Senthil Kumar's picture

Hi,
Also One can use ShapeInterference.hxx class.
Regards,
senthil kumar

Contact us

Attention: DO NOT use this form for all kind of request for the removal of your personal data. Please follow this link for such cases.