ofBuffer to load binary .ply file

Hello All

I’m currently loading a large point cloud as a cvs file. It has 10m points and takes aaaages.
I’m told loading it as a binary format would be quicker. Can anyone point me towards (or provide) a simple example that demonstrates how to do this?

File formats I can produce are all here: http://www.cloudcompare.org/doc/wiki/index.php?title=FILE_I/O
Best
Sam

Have updated the title as I’ve made a bit of progress here now. Still not quite there tho:

ofFile import ("Import.ply", ofFile::ReadOnly, true);
ofBuffer buffer(import);
float* fbuf = (float*)buffer.getData();
int num_points = buffer.size() / (3 * 4);

cout<<num_points<<endl;
for (int i = 0; i < num_points; i++) {
    if (i < 3) {
        cout << "point[" << i << "] ";
        cout << fbuf[i * 3 + 0] << (", ");
        cout << fbuf[i * 3 + 1] << (", ");
        cout << fbuf[i * 3 + 2] << endl;
    }
}

I think all I need to do is to read/skip the header file of the .ply file [format] (http://paulbourke.net/dataformats/ply/) but I don’t know how to do this.

you can load ply using ofMesh::load:

ofMesh mesh;
mesh.load("something.ply");

hmmmm, I thought that was only ascii?

oh yeah sure, i didn’t understood you were using binary format

I recently had to read a binary ply file too and I think I ended up using this: http://www-sop.inria.fr/members/Thijs.Van-Lankveld/