A streaming PLY parser written in JavaScript.
First, install using npm:
npm install parse-ply
Then you can create a stream using require. For example, here is some code that parses a PLY file from stdin and dumps the result to stdout:
require("parse-ply")(process.stdin, function(ply) {
console.log(ply);
});
The properties within the file are all encoded as appropriate typed arrays.
This creates a streaming PLY parser. To use it, pipe in a stream containing your mesh. When it is done, it will emit a data
event that has the parsed PLY file as the main argument.
stream
is a stream objectcb(err, data)
is callback that is executed once the PLY is fully parsed
The returned data
field contains the contents of the completely parsed PLY file and has the two fields:
vertex
: An object whose properties are the attributes of each vertex.face
: An object whose properties are the attributes of each face.
To learn more about the PLY file format, here are some links:
You can also view PLY files using standard tools, like MeshLab:
(c) 2013 Mikola Lysenko. BSD License