Coppelia Geometric Routines
The Coppelia Geometric Routines is a collection of C++ functions that allow to perform the same geometric calculations as you are able to do from within CoppeliaSim (i.e. collision detection, minimum distance calculation, and proximity sensor simulation on meshes, oc-trees and point clouds). Those functions give CoppeliaSim its geometric calculation capability.
You can embedd and use the Coppelia Geometric Routines in your stand-alone application, which then can programmatically set up complex calculation tasks. Refer also to the Coppelia Geometric Routines C++ API documentation.
The Coppelia Geometric Routines source code is not directly part of CoppeliaSim, and carries separate licensing conditions. Refer to the source code for details, and contact us.
Following very simple example illustrates how to measure the smallest distance between two meshes:
int main(int argc, char* argv)
// Create mesh 1 (containing a single triangle, for simplicity):
// Create mesh 2 (containing a single triangle, for simplicity):
// now move and rotate the two meshes and compute their minimum distance:
mesh1Transformation.X=C3Vector(0.5*cos(0.1*t),0.0,0.0); // sinusoidal x-axis movement
mesh2Transformation.X=C3Vector(0.0,0.4*cos(0.2*t),0.3*cos(0.1*t)); // sinusoidal y- and z-axis movement
C3Vector eulerAngles(0.0,0.0,t*1.2); // rotation around vertical axis
// compute the distance:
printf("mesh-mesh minimum distance: %f\n",dist);