Misinterpreting C2M signed distances ?

Feel free to ask any question here
ADf
Posts: 6
Joined: Mon Oct 27, 2025 4:03 pm

Misinterpreting C2M signed distances ?

Post by ADf »

Thank you very much for the support provided on this forum.

I am currently comparing two structures: a reference model that is 100 units tall, and an experimental one approximately 20 units in height. The two structures are centered for the comparison.
The result of the C2M comparison shows an averaged -15 units distance at the top of the compared structure, which is significantly less than the -40 unit difference that would be expected based on their respective heights.
I previously performed the same comparison in MeshLab and obtained similar results using the vertex quality visualization.

I suspect I may be misinterpreting the output values from this type of mesh comparison, and would greatly appreciate any clarification or guidance you can offer.

Thank you in advance.
Last edited by ADf on Thu Oct 30, 2025 2:42 pm, edited 1 time in total.
daniel
Site Admin
Posts: 8158
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Misinterpreting C2M signed distances ?

Post by daniel »

Yes, it's probably due to the fact that the distance is the distance to the nearest triangle (wherever it is). And not the distance in a particular direction. Also, the distance to a triangle is commonly defined like this: https://www.geometrictools.com/Document ... angle3.pdf

What you want is probably the distance along a particular direction... To do this in CC, you would need to first convert the mesh to a dense point cloud (Edit > Mesh > Sample points), and then use the M3C2 plugin, using the sampled mesh cloud as the first cloud, and forcing the normal direction to be 'vertical' (assuming the shape is properly oriented with the height being 'z').
Daniel, CloudCompare admin
ADf
Posts: 6
Joined: Mon Oct 27, 2025 4:03 pm

Re: Misinterpreting C2M signed distances ?

Post by ADf »

Thank you for the explanation and for recommending the M3C2 plugin. I’ve tested it, but the computed distances still appear underestimated, despite adjusting several parameters, including forcing the normal direction to be vertical.
For context, the geometries are on the micrometer scale. Could this level of precision pose limitations in CloudCompare?
I’d like to share the file to illustrate the issue more clearly, but it seems attachments aren’t supported here. Is there an alternative way to provide it—such as a cloud link or preferred upload method?
daniel
Site Admin
Posts: 8158
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Misinterpreting C2M signed distances ?

Post by daniel »

Well, if they are around 1e-6 or 1e-7, yes, it could create some numerical accuracy issues (but then you could simply scale the coordinates with 'Edit > Multiply/scale').

And you can send me files with any file sharing site (google, onedrive or wetransfer for instance) to admin@cloudcompare.org
Daniel, CloudCompare admin
ADf
Posts: 6
Joined: Mon Oct 27, 2025 4:03 pm

Re: Misinterpreting C2M signed distances ?

Post by ADf »

The objects are small, but not that small. That said I did try scaling up the object by a factor of 1000, but the results remained the same. I’ve sent the files to the provided email address, thank you.
daniel
Site Admin
Posts: 8158
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Misinterpreting C2M signed distances ?

Post by daniel »

Indeed the scale is not the issue here.

I tweaked the M3C2 parameters (shared with you by email).

And for the records, here are the results with the M3C2 plugin:
m3c2.jpg
m3c2.jpg (193.78 KiB) Viewed 18894 times
(so about +40units for the top points, and -36units for the bottom points)
Daniel, CloudCompare admin
ADf
Posts: 6
Joined: Mon Oct 27, 2025 4:03 pm

Re: Misinterpreting C2M signed distances ?

Post by ADf »

Thank you very much Daniel for looking at the file and searching suitable M3C2 parameters. I will work on it and see if I obtain similar output.
ADf
Posts: 6
Joined: Mon Oct 27, 2025 4:03 pm

Re: Misinterpreting C2M signed distances ?

Post by ADf »

I used the provided M3C2 parameters and found that switching to Multi-Scale calculation mode and aligning the structures at the bottom was actually more effective for the intended comparison. Now, we do obtain logical scale values. thank you very much for the help provided.
That said, the output values are mainly positive, even though the compared structure is actually smaller than the reference. I tried disabling the 'search only in the positive space' feature, but the results remained the same. Any idea how to obtain more relevant signed values?
daniel
Site Admin
Posts: 8158
Joined: Wed Oct 13, 2010 7:34 am
Location: Grenoble, France
Contact:

Re: Misinterpreting C2M signed distances ?

Post by daniel »

So the sign depends on the normal orientation (and the closest surface). So you might have to invert the normals? (but I don't know if it will always make sense)
Daniel, CloudCompare admin
ADf
Posts: 6
Joined: Mon Oct 27, 2025 4:03 pm

Re: Misinterpreting C2M signed distances ?

Post by ADf »

Following up on this topic, is there a way to fuse the results of multiple M3C2 comparisons? For example, performing comparisons along several preferential directions (X, Y, and Z), then merging the results into a single cloud while preserving the values (e.g. merged histograms) and a consistent color scale?
Post Reply