DG Kernel Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
Overview of the software
What is new
Licensing
Collapse ModelsModels
Expand DG Kernel ComponentsDG Kernel Components
Expand API ReferenceAPI Reference
Expand Samples and TutorialsSamples and Tutorials
Expand GraphicsGraphics
Expand Math ObjectsMath Objects
Expand DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation LinksHome Page > Models > Entities > Movement > Collision Detection Search Documentation


Distances and Collision Detection

Distances between different objects can be calculated with the help of IMetrics interface. IsCloserThan of the same interface is helpful for collision detection during simulation or animation of movements or geometry modifications of an object. Collision sample demonstrates a simple case of such application.

The main issue with programming collision detection is that during the movement simulation the above methods have to be called frequently numerous times and because they apply heavy computational load the process may be slow.  Below are few hints to alleviate the problem.

  • Avoid using includeChildren flag from the contexts structure during the calls to IMetrics.Dist or IsCloserThan methods. and needAllflag during calls to IsCloserThan
  • Choose carefully other parameters from the context structures
  • Complexity of surface of both objects affect significantly the performance so it is recommended to create surrogate invisible copies of the objects with fewer level of details and detect collision between them instead. It is best to make the surrogate a child of the actual object so they will be moved synchronously.
  • Often it is know in advance which part of the object can collide with other objects. So the surrogate can be made to represent this part of the object. Clip planes is one good method to extract such part of the object.
  • Further optimization of the process can be done when path of the movement is known beforehand and the problem is to find the moment when and if the collision occurs. Contact us if you need assistance with this technique.

See Also: Collision Sample

Path Collision Detection

Path Collision Detection is another, higher level technology in DG Kernel for collision detection. Path Collision Detection assumes that movement of objects is known in advance. This allows further optimization of performance inside DG Kernel component. It is assumed that the objects do not initially interfere with each other. The result may be incorrect if it is not true. Number of objects which participate on collision detection is not limited

The functionality is provided by DG Kernel Collision Detector. Collision Detector takes a set of sections (objects) along with paths of their movement. Result of the Collision Detection operation is the time moment when the first collision has occurred.

To perform Path Collision Detection:

  1. Create movement one per each object involved in collision detection with IDIObjGenerator.Create(EObjectType.eObjTypeMove).
  2. Query IMove_KC from the return of the above call and modify the movement as described in Movements topic
  3. Create an instance of Collision Detector with a call to IDIObjGenerator.Create with eType parameter set to eObjTypePathCollisionDetector member of the EObjectType enumeration. 
  4. Query IKCPathCollisionDetector interface from the return of  IDIObjGenerator.Create
  5. Query IKinematicSet_KC from the IKCPathCollisionDetector
  6. Use IKinematicSet_KC.AddObject to add objects along with their movements for detection
  7. Call IKCPathCollisionDetector.Detect to obtain the moments when collision happened
  8. Optional: Call IKinematicSet_KC.SetPosition to display position of objects when the collision occurred
  9. Optional: Call IMetrics.Dist to obtain extended information about nearest points at collision configuration

Note that Path Collision Detection is extremely computation intensive this means that only necessary object should be added for detection and various settings like precision in IKCPathCollisionDetector.Detect call, geometric resolution of the objects and sampling of the movement paths should be set to lowest acceptable values, which can be tuned in after a number of tests.

See Also: Collision Path Sample