C3D Toolkit  Kernel - 118069, Vision - 2.16.7.1844

Collision search and distance measurement query utility. More...

#include <cdet_utility.h>

Public Member Functions

cdet_scene Scene () const
 Get a geometric search scene, which is served by the collision detection utility.
 
cdet_item AddItem (const MbSolid &solid, const MbPlacement3D &place, cdet_app_item appItem=CDET_APP_NULL)
 Add a solid with given placement to the collision detection set. More...
 
cdet_item AddRay (const MbCartPoint3D &vertex, const MbVector3D &direction, const MbPlacement3D &place, cdet_app_item appItem=CDET_APP_NULL)
 Add a ray with given vertex, direction and placement to the collision detection set. More...
 
cdet_item AddComponent (cdet_app_item)
 Add a new component to track collisions and proximity parameters. More...
 
cdet_item AddInstance (cdet_item compItem, cdet_item solidItem, const MbPlacement3D &place)
 Add a new instance of a reused solid into the component. More...
 
cdet_item AddInstance (cdet_item compItem, const MbItem *mbItem, const MbPlacement3D &place, cdet_app_item appItem=CDET_APP_NULL)
 Add a new instance of a reused solid into the component. More...
 
void RemoveItem (cdet_item cdItem)
 Remove a geometric object from the set of collision detection.
 
void Reposition (cdet_item, const MbPlacement3D &)
 Change current position of a geometric object.
 
cdet_result CheckCollisions (cdet_query &)
 Check collisions between geometric objects of the set. More...
 
cdet_result CheckCollisions ()
 Check collisions between geometric objects of the set. More...
 
cdet_app_item AppItem (cdet_item cdItem) const
 Get an application pointer by descriptor of the collision detection set.
 
CdSceneIteratorRange SubItemsRange (cdet_item scnItem) const noexcept
 Return the iterator range of the scene object/component in the collision detector.
 
CdSceneIteratorRange InDepthSubItems (cdet_item scnItem) const noexcept
 Return the iterator range with in depth traversal for the scene object/component in the collision detector.
 
CdSceneIteratorRange SceneItems () const noexcept
 Return the iterator range of all objects in the collision detector scene.
 
cdet_setting_result SetToleranceDelta (cdet_item cqItem, double delta)
 Set the allowed deviation of the solid size inside or outside the shell. More...
 
cdet_item AddMesh (const MbMesh &mesh, const MbPlacement3D &place, cdet_app_item appItem=CDET_APP_NULL, double delta=0.)
 
void RemoveSolid (cdet_item)
 Remove a solid model or ray from a collision detector.
 
size_t Count () const
 Get number of added solid models or rays.
 
size_t SolidIndex (cdet_item cItem) const
 An index of solid model or ray registered in the detector.
 
cdet_result DistanceQuery (CdProximityParameters &) const
 Calculation of minimal distance between objects (see the function SetDistanceTracking)
 
cdet_result DistanceQuery (cdet_item, cdet_item, CdProximityParameters &) const
 Calculation of minimal distance between objects.
 
void FlushSolids ()
 Exclude all models from consideration.
 
cdet_item GetHRepSolid (const MbLumpAndFaces &) const
 Get the hierarchical representation of the solid (CDET_NULL means that the solid is not in the list).
 
void SetTouchTolerance (double lTol)
 Set the barrier for the difference between the touch and the intersection.
 
void SetApproxCollisionQuery (bool ff)
 On/off approximated calculation of intersections of solids.
 
void SetApproxDistanceComputation (bool ff)
 On/off approximated calculation of proximity parameters - by triangulation.
 
void SetDistanceTracking (const MbLumpAndFaces &, const MbLumpAndFaces &)
 Assign the pair to track the distance between them.
 
void SetPlacement (size_t solIdx, const MbPlacement3D &)
 Update current placement of solid or ray with index solIdx.
 
MbeConvResType ExportToC3D (const TCHAR *c3dFile)
 Export collision detection scene into C3D model.
 

Detailed Description

Collision search and distance measurement query utility.

Provides facilities of The Collision Detection to interact with the CAD application.

Attention
For the ensure proper functionality of the detector it is necessary that an object of type MbLumpAndFaces to be added in consideration by function AddSolid will have a correct matrix of transformation to the world coordinate system in its current state, i.e. from the beginning.

Member Function Documentation

◆ AddItem()

cdet_item CdCollisionDetection::AddItem ( const MbSolid &  solid,
const MbPlacement3D &  place,
cdet_app_item  appItem = CDET_APP_NULL 
)

Add a solid with given placement to the collision detection set.

Returns
Descriptor of object for collision detection.

◆ AddRay()

cdet_item CdCollisionDetection::AddRay ( const MbCartPoint3D &  vertex,
const MbVector3D &  direction,
const MbPlacement3D &  place,
cdet_app_item  appItem = CDET_APP_NULL 
)

Add a ray with given vertex, direction and placement to the collision detection set.

Returns
Descriptor of object for collision detection.

◆ AddComponent()

cdet_item CdCollisionDetection::AddComponent ( cdet_app_item  )

Add a new component to track collisions and proximity parameters.

Component is able to unite solids into the rigid geometric sets.

◆ AddInstance() [1/2]

cdet_item CdCollisionDetection::AddInstance ( cdet_item  compItem,
cdet_item  solidItem,
const MbPlacement3D &  place 
)

Add a new instance of a reused solid into the component.

Parameters
[in]compItem- A component to witch the instance will belong.
[in]solidItem- An original solid added by the method AddItem by which the instance is made.
[in]place- The placement that the instance solid takes in global space.
Returns
The new solid instance registered in the detector.
Note
The value compItem can be CDET_NULL. This just means that the instance does not belong to any component.

◆ AddInstance() [2/2]

cdet_item CdCollisionDetection::AddInstance ( cdet_item  compItem,
const MbItem *  mbItem,
const MbPlacement3D &  place,
cdet_app_item  appItem = CDET_APP_NULL 
)

Add a new instance of a reused solid into the component.

Parameters
[in]compItem- A component to witch the instance will belong.
[in]mbItem- An original solid by which the instance is made.
[in]place- The placement that the instance solid takes in global space.
[in]appItem- User geometric item.
Returns
The new solid instance registered in the detector.
Note
The value compItem can be CDET_NULL. This just means that the instance does not belong to any component.

◆ CheckCollisions() [1/2]

cdet_result CdCollisionDetection::CheckCollisions ( cdet_query &  )

Check collisions between geometric objects of the set.

Returns
The function will return CDM_RESULT_CollisionDetected if it detects at least one collision.

◆ CheckCollisions() [2/2]

cdet_result CdCollisionDetection::CheckCollisions ( )

Check collisions between geometric objects of the set.

Returns
The function will return CDM_RESULT_CollisionDetected if it detects at least one collision.

◆ SetToleranceDelta()

cdet_setting_result CdCollisionDetection::SetToleranceDelta ( cdet_item  cqItem,
double  delta 
)

Set the allowed deviation of the solid size inside or outside the shell.

Parameters
[in]cqItem- An scene instance as an object to check collisions with others.
[in]delta- The maximum deviation of a geometric object size from its nominal size.

The delta value can be positive or negative, and defines the tolerance that affects the CheckCollisions result. A negative delta (delta < 0) defines the maximum interference depth with a solid to count a status "no collision". A positive delta (delta>0) defines the minimum distance to an object to count a status "no collision".

Note
By default, each body has a zero size deviation (delta = 0).
Returns
The function returns CDM_PARAMETER_Changed if the tolerance parameter was successfully changed.

◆ AddMesh()

cdet_item CdCollisionDetection::AddMesh ( const MbMesh &  mesh,
const MbPlacement3D &  place,
cdet_app_item  appItem = CDET_APP_NULL,
double  delta = 0. 
)
Note
The call is deprecated. Use AddInstance instead.

The documentation for this class was generated from the following file: