C3D Toolkit  Kernel - 118060, Vision - 2.15.0.1825
+ Collaboration diagram for Collision Detection:

Classes

struct  cdet_query
 Data structure and callbacks for the collision search request. More...
 
struct  cdet_collided_faces
 The structure of the query to find collision faces. More...
 
class  CdCollisionDetection
 Collision search and distance measurement query utility. More...
 
class  CdSceneIterator
 Iterator for traversing objects of collision detector scene. More...
 
struct  CdSceneIteratorRange
 Iterator range of scene for support range-based for loop. More...
 
struct  CDM_instance
 The structure specifing the instance of geometric object (polygonal or boundary representation). More...
 
struct  CDM_component
 A component is a geometric union of bodies or polygonal objects which have their own local coordinate system. More...
 
struct  CDM_ray
 The structure defining the ray in the collision detector scene. More...
 
struct  CDM_callback_table
 The structure uniting collision detection callbacks. More...
 

Typedefs

typedef const CdSceneItem * cdet_item
 Object from the set of collision detection.
 
typedef CDM_result cdet_result
 Result code of collision queries.
 
typedef const MtRefItemcdet_bvt_node
 A node of the bounding volume tree.
 
typedef std::pair< cdet_bvt_node, cdet_bvt_nodecdet_bvt_pair
 A pair of branches of the bounding volume subtree.
 
typedef SPtr< MbItem >(* CDM_item_registered) (cdet_app_item appItem)
 Application item was registered in the scene.
 
typedef void(* CDM_item_unregistered) (cdet_app_item appItem)
 Application item was unregistered in the scene.
 
typedef bool(* CDM_abort) ()
 Query to interrupt calculations.
 

Enumerations

enum  CDM_result { }
 Codes of collision detection or measuring query.
More...
 
enum  cdet_setting_result { CDM_PARAMETER_Applied = 1 , CDM_PARAMETER_NotChanged }
 The result of changing the collision search settings. More...
 

Functions

MbResultType InterferenceSolids (MbSolid &solid1, MbSolid &solid2, std::vector< MbCurveEdge * > *edges, c3d::IndicesPairsVector *intersectedFaces, c3d::IndicesPairsVector *similarFaces, c3d::IndicesPairsVector *touchedFaces)
 Calculation of intersections between solids using the boolean operations. More...
 
cdet_bvt_pair BvtSubNodes (cdet_item, cdet_bvt_node)
 Get the left and the right branches of the bounding volume subtree.
 
void GetOrientedBox (cdet_item, cdet_bvt_node, MbMatrix3D &)
 Transformation matrix yielding bounding parallelepiped from the unit cube.
 
cdet_scene CDM_CreateScene ()
 Create an empty collision detection scene. More...
 
void CDM_RemoveScene (cdet_scene scn)
 Delete collision detection scene. More...
 
cdet_item CDM_AddComponent (cdet_scene scn, const CDM_component &comp)
 Add a new component to the collision detector scene and set proximity parameters. More...
 
cdet_item CDM_AddInstance (cdet_scene scn, const CDM_instance &inst)
 Add a solid with given placement to the collision detection scene. More...
 
cdet_item CDM_AddInstance (cdet_scene scn, cdet_item compItem, const CDM_instance &inst)
 Add a new instance of a reused solid into the component of the collision detector. More...
 
cdet_item CDM_AddRay (cdet_scene scn, const CDM_ray &ray)
 Add a ray to the collision detector scene. More...
 
void CDM_RemoveItem (cdet_scene scn, cdet_item scnItem)
 Remove a geometric object from the scene of collision detector. More...
 
void CDM_Reposition (cdet_scene scn, cdet_item scnItem, const MbPlacement3D &place)
 Change current position of a geometric object. More...
 
cdet_result CDM_CheckCollisions (cdet_scene scn, cdet_query &cdQuery)
 Request a collision search between scene elements. More...
 
cdet_result CDM_CheckCollisions (cdet_scene scn)
 Check collisions between geometric objects of the scene. More...
 
cdet_app_item CDM_AppItem (cdet_scene scn, cdet_item scnItem)
 Get an application pointer by object descriptor of the collision detector scene. More...
 
MbeConvResType CDM_ExportToC3D (cdet_scene scn, const TCHAR *c3dFile)
 Export collision detector scene into C3D model. More...
 
CdSceneIteratorRange CDM_SubItemsRange (cdet_scene scn, cdet_item scnItem)
 Returns an iterator range over the elements of the given scene component (one level only). More...
 
CdSceneIteratorRange CDM_InDepthSubItems (cdet_scene scn, cdet_item scnItem)
 Returns an iterator range with depth‑first traversal of the given scene component. More...
 
CdSceneIteratorRange CDM_SceneItems (cdet_scene scn)
 Return the iterator range of all objects in the collision detector scene.
 
void CDM_ClearScene (cdet_scene scn)
 Exclude all models from consideration.
 

Variables

const cdet_item CDET_NULL = nullptr
 Empty object of the collision query set.
 
const cdet_app_item CDET_APP_NULL = nullptr
 "Null object" of the client app.
 
const cdet_bvt_node CDET_BVT_NULL = nullptr
 An empty bounding volume tree.
 

Detailed Description

Enumeration Type Documentation

◆ CDM_result

enum CDM_result

Codes of collision detection or measuring query.

Enumerator
CDM_RESULT_MeasuringSucceed 

Successful result of a measurement request (for example, a distance query).

CDM_RESULT_NoCollisionDetected 

No collision was detected. There are no intersections or the search was aborted.

CDM_RESULT_CollisionDetected 

Volume intersection (collision) detected.

CDM_RESULT_Error 

Unknown error or internal system error.

◆ cdet_setting_result

The result of changing the collision search settings.

Enumerator
CDM_PARAMETER_Applied 

The setting parameter was applied successfully.

Function Documentation

◆ InterferenceSolids()

MbResultType InterferenceSolids ( MbSolid solid1,
MbSolid solid2,
std::vector< MbCurveEdge * > *  edges,
c3d::IndicesPairsVector intersectedFaces,
c3d::IndicesPairsVector similarFaces,
c3d::IndicesPairsVector touchedFaces 
)

Calculation of intersections between solids using the boolean operations.

Calculation of intersections between solids using the boolean operations.

Parameters
[in]solid1- The first solid.
[in]solid2- The second solid.
[out]edges- Intersection edges.
[out]intersectedFaces- The couples of indeses intersected faces of the solids,
[out]touchedFaces- The couples of indeses of contacted faces with oppositely directed normals.
[out]similarFaces- The couples of indeses of relating to similar faces that can be combined.
Returns
Operation result code.
Warning
The solids will be modified by this operation! To keep the body intact, give the copies made using MbSolid::Duplicate().

◆ CDM_CreateScene()

cdet_scene CDM_CreateScene ( )

Create an empty collision detection scene.

Returns
Descriptor of collision detection scene and proximity queries.

◆ CDM_RemoveScene()

void CDM_RemoveScene ( cdet_scene  scn)

Delete collision detection scene.

This method releases memory from internal data structures maintaining the collision detector. The removed collision scene is invalidated after this call.

Parameters
[in]scn- Scene of the collision and proximity queries.

◆ CDM_AddComponent()

cdet_item CDM_AddComponent ( cdet_scene  scn,
const CDM_component comp 
)

Add a new component to the collision detector scene and set proximity parameters.

Parameters
[in]comp- A component that is a geometric union of bodies or polygonal objects. It have its own local coordinate system.
Returns
New component registered in the collision detector scene.

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

◆ CDM_AddInstance() [1/2]

cdet_item CDM_AddInstance ( cdet_scene  scn,
const CDM_instance inst 
)

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

Parameters
[in]inst- The instance record of geometric object (polygonal or boundary representation).
Returns
Descriptor of object for collision detection.
Reused scene elements.

The same instance of the 'MbItem' class can be added to the scene as many times as necessary using this call. When the same geometric object is added multiple times, the collision detector creates only one search data structure (BVT). The memory and computation time resources spent to create this structure, are reused for all scene instances based on the same 'MbItem' object.

◆ CDM_AddInstance() [2/2]

cdet_item CDM_AddInstance ( cdet_scene  scn,
cdet_item  compItem,
const CDM_instance inst 
)

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

Parameters
[in]compItem- A component to witch the instance will belong.
[in]inst- The instance record of geometric object (polygonal or boundary representation).
Returns
Descriptor of solid instance registered in the detector.
Note
The value compItem can be CDM_NULL. This just means that the instance doesn't belong to any component.

◆ CDM_AddRay()

cdet_item CDM_AddRay ( cdet_scene  scn,
const CDM_ray ray 
)

Add a ray to the collision detector scene.

Parameters
[in]ray- Geometric representation of ray.
Returns
Descriptor of object for collision detector scene.

◆ CDM_RemoveItem()

void CDM_RemoveItem ( cdet_scene  scn,
cdet_item  scnItem 
)

Remove a geometric object from the scene of collision detector.

Parameters
[in]scnItem- Decriptor of object in collision detector scene.

◆ CDM_Reposition()

void CDM_Reposition ( cdet_scene  scn,
cdet_item  scnItem,
const MbPlacement3D place 
)

Change current position of a geometric object.

Parameters
[in]scnItem- Decriptor of object in collision detector scene.
[in]place- The placement that the object takes in global space.

◆ CDM_CheckCollisions() [1/2]

cdet_result CDM_CheckCollisions ( cdet_scene  scn,
cdet_query cdQuery 
)

Request a collision search between scene elements.

Returns
Collision control result codes and distance measurement.

The search for collisions between scene elements is performed according to the cdQuery structure, namely, pairs are checked both at the root level, including entire components, and at the level within a component. The client application has the ability to configure the query so as to search not for collisisons "all with all", but only between groups of objects.

◆ CDM_CheckCollisions() [2/2]

cdet_result CDM_CheckCollisions ( cdet_scene  scn)

Check collisions between geometric objects of the scene.

Returns
Collision control result codes and distance measurement.

◆ CDM_AppItem()

cdet_app_item CDM_AppItem ( cdet_scene  scn,
cdet_item  scnItem 
)

Get an application pointer by object descriptor of the collision detector scene.

Parameters
[in]scnItem- Object descriptor in the collision detector scene.
Returns
Descriptor of client application.

◆ CDM_ExportToC3D()

MbeConvResType CDM_ExportToC3D ( cdet_scene  scn,
const TCHAR *  c3dFile 
)

Export collision detector scene into C3D model.

Parameters
[in]c3dFile- The name of the file.
Returns
Result of converting operation.

◆ CDM_SubItemsRange()

CdSceneIteratorRange CDM_SubItemsRange ( cdet_scene  scn,
cdet_item  scnItem 
)

Returns an iterator range over the elements of the given scene component (one level only).

Parameters
[in]scnItem- Object of the collision detector scene.

◆ CDM_InDepthSubItems()

CdSceneIteratorRange CDM_InDepthSubItems ( cdet_scene  scn,
cdet_item  scnItem 
)

Returns an iterator range with depth‑first traversal of the given scene component.

Parameters
[in]scnItem- Object of the collision detector scene.