Roman Sadovnikov, Ph.D., a C3D Solver software developer, C3D Labs, talks about the new features of the C3D Collision Detection module.
The C3D Collision Detection module’s applications extend to many industries, including aerospace and automotive, where it is used to manage autonomous vehicles (Fig. 1). The module is also a safeguard for robots, packers, and NC tools operating in a dynamic environment. It prevents machine-to-human collisions. In games and medical applications, the module handles collisions between virtual objects in surgical simulators. In construction and logistics, C3D Collision Detection monitors clearances and supports 3D design and computer-aided construction processes.
The module uses computational geometry to detect body intersections and tangents, measure distances between bodies, prevent collisions, calculate penetration depths, and simulate body contacts. For scenes with many objects, high performance and low demands on CPU and memory resources are essential. To improve efficiency, we use special data structures and procedures optimized for computational complexity.
Objects checked by the collision detector are positioned relative to the same origin. The scene supports patterns and instances to reuse the same object in different positions without data duplication. For example, an instance of the MbItem class can be added to the scene more than once and in different positions, while the Bounding Volume Tree search structure is built only once. This significantly reduces memory usage and improves performance.
It is a highly efficient approach to placing multiple elements (such as pipe sections) in a scene. The reuse saves resources and increases performance. Another concept in a scene is a component: an assembly of multiple objects with their individual positions. The tree-like structure of the scene is perfect for quick, targeted traversal of objects and fast search. The scene also handles the repositioning of instances and components. The entire scene structure can be exported to the C3D format for reuse.
We have recently added the functional API. From now on, it is the primary tool. All calls to the object-oriented API are redirected to the functional API. This is useful for logging, regression testing, and remote tech support. Besides, only the functional API needs to be tested and debugged. You can easily create wrappers for other programming languages, such as C#, JavaScript, and Python.
It also simplifies the code (no complex class hierarchies), promotes modularity and code reuse, and facilitates parallel and distributed computing.
the functional API includes two auxiliary types. This is a CDM_component used to add a component to the scene with a specified position relative to the scene's global coordinate system (Fig. 2). Another type is CDM_instance. It can add an MbItem instance with its position specified relative to either a component or the scene’s global coordinate system.
Let me show you why the functional API is convenient (Fig. 3). The first line of code creates the scene and allocates the resources. The third and fourth lines add a component to the global coordinate system of the scene. The fifth and sixth lines add an instance of a body. In this case, the local coordinate system of the component is used. In the sixth line, the detector adds an instance to the component, which is already positioned relative to the global coordinate system of the scene. It is convenient for the user to position elements in the scene. The seventh line checks for collisions, and the eighth line frees up resources and deletes the scene.
Next, let us consider an example of a tree structure of a scene and a new collision detection procedure (Fig. 4). This shows how two components (two instances of a body) are added, and how the tree is built. All four of these objects are children of the tree root. Next, we add several instances of the bodies to each component. The resulting tree structure of the scene is shown below. A breadth-first traversal procedure is used. First, collisions between the elements of the tree root node are checked. The remaining collisions between components are checked upon request. This structure provides effective management of search queries.
In response to user requests, we have implemented the SetTouchTolerance function. With it, minor body intersections are detected as contacts. The detector does not report such intersections. A negative tolerance can be specified to treat intersections as contacts. Fig. 5, left, shows two bodies intersecting. When a tolerance is specified, this is detected as a contact. There is no intersection on the right. To detect a contact, specify a positive tolerance. This option is not as common, but it is also supported.
At the request of Pilot-BIM, we have added a new feature: ignoring minor intersections between B-Rep bodies (Fig. 6). The SetToleranceDelta function specifies an individual delta value for each object. To ignore an intersection or gap, set delta < 0 for intersections or delta > 0 for gaps.
Now, scene objects can be repositioned. Previously, the object-oriented API was used for this. You can move the entire component. Fig. 7 shows an example of a scene with two components containing two instances each. The transformation matrix applies to the entire component and all object instances it contains. The collision detector moves each instance.
We have added the ExportToC3D function to export scenes to the C3D format (Fig. 8). This is convenient to check the object arrangement and to reuse the scene in other applications.
In the future, we will enhance the intersection/contact detection for B-Rep bodies using exact face/edge definitions. We are going to implement an API for creating the MbAssembly object that represents the entire component with all its objects. Upon customer request, we will provide native support for bounding boxes used as colliders. We'll keep working on the API and user documentation.

Roman Sadovnikov
Ph.D., software developer,
C3D Labs











