Euclid
Geometry Processing and Shape Analysis in C++
Euclid::CommonPlyWriter< VN, FloatType, IndexType, ColorType > Class Template Reference

A ply writer for a common set of properties. More...

#include <PlyIO.h>

Inheritance diagram for Euclid::CommonPlyWriter< VN, FloatType, IndexType, ColorType >:
Euclid::PlyWriter

Public Member Functions

 CommonPlyWriter (const std::vector< FloatType > &positions, const std::vector< FloatType > *normals=nullptr, const std::vector< FloatType > *texcoords=nullptr, const std::vector< IndexType > *indices=nullptr, const std::vector< ColorType > *colors=nullptr)
 Constructor. More...
 
void on_write () override
 On writing the ply file. More...
 
PlyHeader generate_header (PlyFormat format) const override
 Generate the ply header. More...
 
void write (const PlyDoubleProperty *property, std::ofstream &stream, PlyFormat format) override
 Write a PlyDoubleProperty.
 
void write (const PlyFloatProperty *property, std::ofstream &stream, PlyFormat format) override
 Write a PlyFloatProperty.
 
void write (const PlyIntProperty *property, std::ofstream &stream, PlyFormat format) override
 Write a PlyIntProperty.
 
void write (const PlyUintProperty *property, std::ofstream &stream, PlyFormat format) override
 Write a PlyUintProperty.
 
void write (const PlyUcharProperty *property, std::ofstream &stream, PlyFormat format) override
 Write a PlyUcharProperty.
 
- Public Member Functions inherited from Euclid::PlyWriter
virtual void write (const PlyShortProperty *, std::ofstream &, PlyFormat)
 Write a PlyShortProperty.
 
virtual void write (const PlyUshortProperty *, std::ofstream &, PlyFormat)
 Write a PlyUshortProperty.
 
virtual void write (const PlyCharProperty *, std::ofstream &, PlyFormat)
 Write a PlyCharProperty.
 

Additional Inherited Members

- Protected Attributes inherited from Euclid::PlyWriter
bool _sys_little_endian
 

Detailed Description

template<int VN, typename FloatType, typename IndexType, typename ColorType>
class Euclid::CommonPlyWriter< VN, FloatType, IndexType, ColorType >

The most common ply files have the following header specification,

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

So this class provides a native implementation to write this type of ply files. Note that it's assumed that all faces have the same number of vertices.

Constructor & Destructor Documentation

template<int VN, typename FloatType , typename IndexType , typename ColorType >
Euclid::CommonPlyWriter< VN, FloatType, IndexType, ColorType >::CommonPlyWriter ( const std::vector< FloatType > &  positions,
const std::vector< FloatType > *  normals = nullptr,
const std::vector< FloatType > *  texcoords = nullptr,
const std::vector< IndexType > *  indices = nullptr,
const std::vector< ColorType > *  colors = nullptr 
)
inline

The values of the properties are read from the buffers supplied here. Set to nullptr to omit the values of that property.

Member Function Documentation

template<int VN, typename FloatType , typename IndexType , typename ColorType >
PlyHeader Euclid::CommonPlyWriter< VN, FloatType, IndexType, ColorType >::generate_header ( PlyFormat  format) const
overridevirtual

The PlyWriter is in charge of generating the header based on the data given.

Reimplemented from Euclid::PlyWriter.

template<int VN, typename FloatType , typename IndexType , typename ColorType >
void Euclid::CommonPlyWriter< VN, FloatType, IndexType, ColorType >::on_write ( )
overridevirtual

This function is called right before writing the ply file. Override this function if you wish to do some preprocessing, e.g. resetting the inner iterator.

Reimplemented from Euclid::PlyWriter.


The documentation for this class was generated from the following files: