This is a code to read PLY files in ASCII format. The PLY files are a geometrical representation of a mesh, and it was developed for the Stanford University. Code is using the RPly library, developed by Diego Nehab. In this version, is more readable than original examples to be used easily.
The project creates a namespace called Surface
. A Surface
contains a std::vector
of vert
and face
, defined as:
struct vert
{
float x;
float y;
float z;
};
struct face
{
int id0;
int id1;
int id2;
};
Both vertexes and faces, are read using callback functions (it is possible to use lambda functions actually). You can use the namespace as:
if (Surface::loadFile(filename)){
// your code here
}
In main.cpp
there is a snippet code for that, using the surfaceAB.ply
file.