cnr-isti-vclab / meshlab

The open source mesh processing system
http://www.meshlab.net
GNU General Public License v3.0
4.83k stars 831 forks source link

the comparsion of float when removing duplicate vertice #1453

Open DamonsJ opened 11 months ago

DamonsJ commented 11 months ago

when I load stl file in meshlab, I want to unify the vertice, and remove the duplicate vertice. It is in the function RemoveDuplicateVertex which is located at src\vcglib\vcg\complex\algorithms\clean.h As a result , I found it compare vertice coordinate using simple operator ==
which is located at : src\vcglib\vcg\space\deprecated_point3.h

It means if the vetex is float type , it just compare float using operator ==

Is this reasonable? Or are there other considerations?

thanks!

alemuntoni commented 9 months ago

Well, it depends on the application. If duplicated vertices are there because imported from a format that stores not indexed meshes, it is reasonable because the vertex coordinates are going to be likely the same, and detected with operator ==. But I agree that for some other applications, an additional tolerance could be useful.

jmespadero commented 8 months ago

To use tolerance in the distances, you can use the filter "Merge close vertices" instead of "Remove duplicates"