BrunoLevy / geogram

a programming library with geometric algorithms
Other
1.87k stars 126 forks source link

Debug assertion when reading PLY file with color information #160

Closed aTerminal closed 4 months ago

aTerminal commented 4 months ago

I noticed that when I try to read a PLY file with point color information in debug mode, an assertion like the following is always triggered: geo_debug_assert(mesh_.vertices.dimension() >= 9); This code is located at line 1879, src/lib/geogram/mesh/mesh_io.cpp. Since this is a debug assertion, it will not trigger any warnings when running in Release mode and can pass smoothly. I would like to ask if there is a bug in this part of the assertion. Based on the context of the code, my understanding is that the purpose of this part of the code is to detect whether the color dimension exceeds 9 dimensions, but the file I tested only contains 3-dimensional color information, and the assertion is also triggered. Maybe the trigger condition of the assertion should be changed to geo_debug_assert(mesh_.vertices.dimension() < 9);? If there is anything wrong, please correct me. Thank you.

BrunoLevy commented 4 months ago

Hello, Thank you for notifying, I have removed this assertion, that means nothing now ! The reason it was there dates back to time where there were no Attributes in geogram, then normals and colors were stored as additional vertex "coordinates" (hence 9 for x,y,z, Nx,Ny,Nz and r,g,b)