Euclid
Geometry Processing and Shape Analysis in C++
Ply I/O

Ply I/O. More...

Classes

class  Euclid::PlyProperty
 Base class for ply property. More...
 
class  Euclid::PlyDoubleProperty
 A double ply property. More...
 
class  Euclid::PlyFloatProperty
 A float ply property. More...
 
class  Euclid::PlyIntProperty
 An int ply property. More...
 
class  Euclid::PlyUintProperty
 An unsigned int ply property. More...
 
class  Euclid::PlyShortProperty
 A short ply property. More...
 
class  Euclid::PlyUshortProperty
 An unsigned short ply property. More...
 
class  Euclid::PlyCharProperty
 A char ply property. More...
 
class  Euclid::PlyUcharProperty
 An unsigned char ply property. More...
 
class  Euclid::PlyElement
 Ply element. More...
 
class  Euclid::PlyHeader
 Ply header. More...
 
class  Euclid::PlyReader
 An abstrct class for ply reader. More...
 
class  Euclid::PlyWriter
 An abstract ply writer. More...
 
class  Euclid::CommonPlyReader< VN, FloatType, IndexType, ColorType >
 A ply reader for a common set of properties. More...
 
class  Euclid::CommonPlyWriter< VN, FloatType, IndexType, ColorType >
 A ply writer for a common set of properties. More...
 

Enumerations

enum  Euclid::PlyFormat { Euclid::PlyFormat::ascii, Euclid::PlyFormat::binary_little_endian, Euclid::PlyFormat::binary_big_endian }
 Ply file format. More...
 

Functions

PlyHeader Euclid::read_ply_header (const std::string &filename)
 Read ply header. More...
 
void Euclid::read_ply (const std::string &filename, PlyReader &reader)
 Read ply file using a custom PlyReader. More...
 
template<int VN, typename FloatType , typename IndexType , typename ColorType , typename Interface >
void Euclid::read_ply (const std::string &filename, std::vector< FloatType > &positions, std::vector< FloatType > *normals, std::vector< FloatType > *texcoords, std::vector< IndexType > *indices, std::vector< ColorType > *colors)
 Read ply file using CommonPlyReader. More...
 
void Euclid::write_ply (const std::string &filename, PlyWriter &writer, PlyFormat format=PlyFormat::ascii)
 Write ply file. More...
 
template<int VN, typename FloatType , typename IndexType , typename ColorType , typename Interface >
void Euclid::write_ply (const std::string &filename, const std::vector< FloatType > &positions, const std::vector< FloatType > *normals, const std::vector< FloatType > *texcoords, const std::vector< IndexType > *indices, const std::vector< ColorType > *colors, PlyFormat format=PlyFormat::ascii)
 Write ply file using CommonPlyWriter. More...
 

Detailed Description

Ply file conceptually consists of geomety elements, e.g. vertex and face. And each element has one or more properties, e.g. a vertex has x, y, z coordinates. As a result, ply is quite versatile and you can store many properties using this format. For the sake of simplicity however, you should consider using the free read and write functions provided in this module since they can deal with the most common type of ply file used in geometry processing. When you need to customize the ply format, you can try to extend the abstract interface PlyReader and PlyWriter.

Enumeration Type Documentation

enum Euclid::PlyFormat
strong

Ply can be stored in 3 file formats, i.e. ascii text, little endian and big endian binary formats.

Enumerator
ascii 

text mode.

binary_little_endian 

little endian binary mode.

binary_big_endian 

big endian binary mode.

Function Documentation

void Euclid::read_ply ( const std::string &  filename,
PlyReader reader 
)
inline

Read a custom ply file format by providing a PlyReader. If you are reading a common ply file, consider using other overloadings specifically designed to read common ply properties like positions, normals, texcoords, indices and colors.

template<int VN, typename FloatType , typename IndexType , typename ColorType , typename Interface >
void Euclid::read_ply ( const std::string &  filename,
std::vector< FloatType > &  positions,
std::vector< FloatType > *  normals,
std::vector< FloatType > *  texcoords,
std::vector< IndexType > *  indices,
std::vector< ColorType > *  colors 
)

A convenient function to read the most common ply properties like below,

element vertex
property float/double x // vertex position
property float/double y
property float/double z
property float/double nx // vertex normal, optional
property float/double ny
property float/double nz
property float/double s/texture_u // texture coordinate, optional
property float/double y/texture_v
property uchar red // vertex color, optional
property uchar green
property uchar blue
property uchar alpha // alpha is optional for color
element face
property list uchar int/uint vertex_index/vertex_indices // optional
Template Parameters
VNNumber of vertices per face.
FloatTypeType of floating point value.
IndexTypeType of index value.
ColorTypeType of color value.
InterfaceUser should never specify the type for it.
Parameters
filenameInput file name.
positionsVertex positions.
normalsVertex normals, use nullptr if you don't want to read this property.
texcoordsVertex texture coordinates, use nullptr if you don't want to read this property.
indicesIndices, use nullptr if you don't want to read this property.
colorsVertex colors, use nullptr if you don't want to read this property.

Note

Proper overloading functions are implemented so that it's not necessary to provide template parameters even if nullptr is used.

See also
CommonPlyReader
PlyHeader Euclid::read_ply_header ( const std::string &  filename)
inline
See also
PlyHeader
void Euclid::write_ply ( const std::string &  filename,
PlyWriter writer,
PlyFormat  format = PlyFormat::ascii 
)
inline

Write a custom ply file format by providing a PlyWriter. If you are writing a common ply file, consider using other overloadings specifically designed to write common ply properties like positions, normals, texcoords, indices and colors.

template<int VN, typename FloatType , typename IndexType , typename ColorType , typename Interface >
void Euclid::write_ply ( const std::string &  filename,
const std::vector< FloatType > &  positions,
const std::vector< FloatType > *  normals,
const std::vector< FloatType > *  texcoords,
const std::vector< IndexType > *  indices,
const std::vector< ColorType > *  colors,
PlyFormat  format = PlyFormat::ascii 
)

A convenient function to write the most common ply properties like below,

element vertex
property float/double x // vertex position
property float/double y
property float/double z
property float/double nx // vertex normal, optional
property float/double ny
property float/double nz
property float/double s/texture_u // texture coordinate, optional
property float/double y/texture_v
property uchar red // vertex color, optional
property uchar green
property uchar blue
property uchar alpha // alpha is optional for color
element face
property list uchar int/uint vertex_index/vertex_indices // optional
Template Parameters
VNNumber of vertices per face.
FloatTypeType of floating point value.
IndexTypeType of index value.
ColorTypeType of color value.
InterfaceUser should never specify the type for it.
Parameters
filenameOutput file name.
positionsVertex positions.
normalsVertex normals, use nullptr if you don't want to write this property.
texcoordsVertex texture coordinates, use nullptr if you don't want to write this property.
indicesIndices, use nullptr if you don't want to write this property.
colorsVertex colors, use nullptr if you don't want to write this property.
formatPly encoding format.

Note

Proper overloading functions are implemented so that it's not necessary to provide template parameters even if nullptr is used.

See also
CommonPlyWriter