How to use coppelia geometric routines

Typically: "How do I... ", "How can I... " questions
Post Reply
biscuit168
Posts: 2
Joined: 16 Nov 2023, 04:16

How to use coppelia geometric routines

Post by biscuit168 »

Hello,
I have one question.
I don't know how to create a mesh object using the geom_createMesh function and how to set the parameter indices in the function.
I read the routine for measuring the minimum distance between two meshes, but I don't know how indices should change when the number of vertices increases, is there anything that can help me understand this parameter?

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: How to use coppelia geometric routines

Post by coppelia »

Read more about meshes e.g. here

Cheers

biscuit168
Posts: 2
Joined: 16 Nov 2023, 04:16

Re: How to use coppelia geometric routines

Post by biscuit168 »

coppelia wrote: 16 Nov 2023, 08:31 Read more about meshes e.g. here

Cheers
Thank you very much, this is very useful to me.
I'm having another problem. When I set meshTransformation.X to C3Vector(0.0, 0.0, 0.0) and meshTransformation.Q to setIdentity(), the detection minimum distance returns 0. Here is my code snippet, what is the reason for this?

Code: Select all

C7Vector mesh1Transformation;
mesh1Transformation.X = C3Vector(0.0, 0.0, 0.0); 
mesh1Transformation.Q.setIdentity();
C7Vector mesh2Transformation;
mesh2Transformation.X = C3Vector(0.0, 0.0, 0.0); 
mesh2Transformation.Q.setIdentity();
double dist = REAL_MAX;
geom_getMeshMeshDistanceIfSmaller(mesh1, mesh1Transformation, mesh2, mesh2Transformation, dist);

coppelia
Site Admin
Posts: 10375
Joined: 14 Dec 2012, 00:25

Re: How to use coppelia geometric routines

Post by coppelia »

Sorry, I initially didn't notice your question was related to the c++ Coppelia Geometric Routines.

Why the function geom_getMeshMeshDistanceIfSmaller returns a distance of 0.0, I am not sure... this obviously will depends on the type of mesh you are using as mesh1 and mesh2...

In case of doubt, and for quick testing, it is often more convenient to use first the Lua/Python counterpart functions within a CoppeliaSim script (i.e. simGeom.createMesh, simGeom.getMeshMeshDistance, etc.). Have a look at the demo scene scenes/sceneObjectIndependentGeometricCalculationExample.ttt

(the simGeom plugin uses internally the Coppelia Geometric Routines, and e.g. calling simGeom.getMeshMeshDistance will indirectly call geom_getMeshMeshDistanceIfSmaller in the plugin)

Cheers

Post Reply