command line cloud to mesh distance (c2m_dist)

To post any request/idea for new functionalities
Post Reply
NeoB
Posts: 2
Joined: Fri Feb 02, 2018 6:44 am

command line cloud to mesh distance (c2m_dist)

Post by NeoB »

hello everybody,

I am trying to automize some processes in CC with the command line.And it works great for the most part.
My Problem is that in the command line the command c2m_dist only gives the result on the cloud, not on the mesh.
Doesn't matter which Order I give. (-O Meshfile -O Cloudfile or -O Cloudfile -O Meshfile produces the same result => always on the cloud and the mesh is the reference)
Also in CloudCompare normally you can with the button c2m_dist compare two meshes in some cases. (For example a Plane and a mesh)
And Choose which mesh is the Reference.

If you do it in CC you get the following error:
Error message: No pointcloud available. Be sure to open or generate one first

Now is it possible to get this functionality also in the command line without to much work?
(Either mesh to mesh or the possiblity to choose between mesh and cloud as reference, for example the first that is loaded)

I would be very glad.

Best regards
daniel
Site Admin
Posts: 7330
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: command line cloud to mesh distance (c2m_dist)

Post by daniel »

In the GUI version, the 'compared' entity is considered as a cloud (only its vertices are used for the computation). So it's indeed a C2M distance that is computed.

In the command line version, clouds and meshes are more strictly segregated. This is why you get an error about the fact that no point cloud is available.

I added a small option to (partially) solve your issue:
-EXTRACT_VERTICES

This will extract the vertices of all loaded meshes and transfer them to the clouds set. This way you can first load your 'compared' mesh, extract its vertices as cloud, and then load the 'reference' mesh. This way you'll be able to compute the C2M distances.

The issue is that the result will be a cloud and not a mesh anymore... Well you'll get the exact same information in the end, but it might be visually different.

An option is of course to load both the original mesh and the generated cloud with distances in the GUI version, and then transfer the distances from the cloud to the mesh vertices (with 'Edit > Scalar fields > Interpolate from another entity'). However I guess you don't want to rely on the GUI version!
Daniel, CloudCompare admin
NeoB
Posts: 2
Joined: Fri Feb 02, 2018 6:44 am

Re: command line cloud to mesh distance (c2m_dist)

Post by NeoB »

Hello Daniel,

Thank you for the quick Answer.

Unfortunately it doesn't solve my Problem, but that's ok.

The whole Points is to automize the process (by letting the computer do the steps) so using the GUI version would make no sense.
I already did the solution with the pointcloud just not with -EXTRACT_VERTICES, i used -SAMPLE_MESH POINTS 1000000. But like you thought, the mesh result with the GUI is visually more appealing. Maybe the pointcloud solution will suffice, with enough points.

But thank you for your suggestions. I will look, how I can solve my Problem.

Best regards
Post Reply