Open ebknudsen opened 6 years ago
It would be great to have a more flexible / tolerant off/ply reader - especially for use with Peter Link's reflectivity patch (which lists an m-value after each face definition)
Related Peter Link patch mentioned here: https://github.com/McStasMcXtrace/McCode/issues/540
Consider also if read_table-lib should be used for the reading of these files...
A suggestion for a more flexible OFF "standard" would include surface normals and extra surface data, ala:
OFF
comment(s)
N n 0
comment(s)
x_0 y_0 z0 (n{x0} n{y0} n{z0}) x_1 y_1 z1 (n{x1} n{y1} n{z1}) ... x{N-1} y{N-1} z_{N-1}
comment(s)
m_0 i_0 j_0 k_0 (l_0) [surfparms0] ... m{n-1} i{n-1} j{n-1} (l{n-1}) [surfparms{n-1}]
Further, we should probably tolerate face indexing starting from 0 or 1 - both types of output exist...
Multiple face ranks in one file (e.g. both triangles and rectangles) is probably too complex, but a (non-coredump) failure should be raised.
The Off/ply-file reader often crashes with a seg.-fault if the file is not quite formatted right. Instances:
Instead the format has to be (the comments are optional):
where N is the number of vertices, n the number of faces, x_q, y_q, z_q are the coordinates for vertex q. m is the number of vertices forming the face. Lastly, i_q, j_q, k_q, and l_q are vertex indices that make up face q, and so on