chickadee » gl-utils » load-ply

load-ply FILE BUFFER-SPECprocedure

Loads a PLY file. FILE is a path that may be pointing either to a gziped PLY file or a regular PLY file. BUFFER-SPEC is a list in the form ((NAME VARS) ...) where NAME is the name of an element in the PLY file and VARS is either a list of property names or, in the case of a property list, a single name. Two values are returned: a list of bytevectors which correspond to the buffers named in BUFFER-SPEC and a list of the elements that are in the PLY file in the form of:

   (element-name n-elements (property-name property-type))

Or, when an element is a property list:

   (element-name n-elements (property-name (list: list-length-type element-type)))

The buffers returned are packed with the contents of the properties named in the BUFFER-SPEC. Thus, for a PLY file that has element vertex with properties float x, float y, float z, float confidence, uchar r, uchar g, and uchar b, as well as an element face with a property list uchar ushort vertex_index, the following BUFFER-SPEC could be used:

   (load-ply "example.ply.gz" '((vertex: (x y z r g b)) (face: vertex_index)))

This buffer spec would result in a list of two u8vectors being returned: one with the packed elements corresponding to properties x, y, z, r, g, and b (with the corresponding property types), and the second containing the vertex indices.