Ply I/O.
More...
|
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...
|
|
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.
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.
|
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
property float/double y
property float/double z
property float/double nx
property float/double ny
property float/double nz
property float/double s/texture_u
property float/double y/texture_v
property uchar red
property uchar green
property uchar blue
property uchar alpha
element face
property list uchar int/uint vertex_index/vertex_indices
- Template Parameters
-
VN | Number of vertices per face. |
FloatType | Type of floating point value. |
IndexType | Type of index value. |
ColorType | Type of color value. |
Interface | User should never specify the type for it. |
- Parameters
-
filename | Input file name. |
positions | Vertex positions. |
normals | Vertex normals, use nullptr if you don't want to read this property. |
texcoords | Vertex texture coordinates, use nullptr if you don't want to read this property. |
indices | Indices, use nullptr if you don't want to read this property. |
colors | Vertex 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 |
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
property float/double y
property float/double z
property float/double nx
property float/double ny
property float/double nz
property float/double s/texture_u
property float/double y/texture_v
property uchar red
property uchar green
property uchar blue
property uchar alpha
element face
property list uchar int/uint vertex_index/vertex_indices
- Template Parameters
-
VN | Number of vertices per face. |
FloatType | Type of floating point value. |
IndexType | Type of index value. |
ColorType | Type of color value. |
Interface | User should never specify the type for it. |
- Parameters
-
filename | Output file name. |
positions | Vertex positions. |
normals | Vertex normals, use nullptr if you don't want to write this property. |
texcoords | Vertex texture coordinates, use nullptr if you don't want to write this property. |
indices | Indices, use nullptr if you don't want to write this property. |
colors | Vertex colors, use nullptr if you don't want to write this property. |
format | Ply 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