| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- #ifndef IGL_READPLY_H
- #define IGL_READPLY_H
- #include "igl_inline.h"
- #include <Eigen/Core>
- #include <string>
- #include <vector>
- #include "tinyply.h"
- namespace igl
- {
- /// Read triangular mesh from ply file, filling in vertex positions, normals
- /// and texture coordinates, if available
- /// also read additional properties associated with vertex,faces and edges
- /// and file comments
- ///
- /// @tparam Derived* from Eigen matrix parameters
- /// @param[in] ply_stream ply file input stream
- /// @param[out] V (#V,3) matrix of vertex positions
- /// @param[out] F (#F,3) list of face indices into vertex positions
- /// @param[out] E (#E,2) list of edge indices into vertex positions
- /// @param[out] N (#V,3) list of normals
- /// @param[out] UV (#V,2) list of texture coordinates
- /// @param[out] VD (#V,*) additional vertex data
- /// @param[out] Vheader (#V) list of vertex data headers
- /// @param[out] FD (#F,*) additional face data
- /// @param[out] Fheader (#F) list of face data headers
- /// @param[out] ED (#E,*) additional edge data
- /// @param[out] Eheader (#E) list of edge data headers
- /// @param[out] comments (*) file comments
- /// @return true on success, false on errors
- ///
- /// \note Unlike previous versions, all matrices are left untouched if they
- /// are not read from the file.
- template <
- typename DerivedV,
- typename DerivedF,
- typename DerivedE,
- typename DerivedN,
- typename DerivedUV,
- typename DerivedVD,
- typename DerivedFD,
- typename DerivedED
- >
- bool readPLY(
- std::istream & ply_stream,
- Eigen::PlainObjectBase<DerivedV> & V,
- Eigen::PlainObjectBase<DerivedF> & F,
- Eigen::PlainObjectBase<DerivedF> & E,
- Eigen::PlainObjectBase<DerivedN> & N,
- Eigen::PlainObjectBase<DerivedUV> & UV,
- Eigen::PlainObjectBase<DerivedVD> & VD,
- std::vector<std::string> & Vheader,
- Eigen::PlainObjectBase<DerivedFD> & FD,
- std::vector<std::string> & Fheader,
- Eigen::PlainObjectBase<DerivedED> & ED,
- std::vector<std::string> & Eheader,
- std::vector<std::string> & comments
- );
- /// \overload
- /// @param[in] ply_file ply file name
- template <
- typename DerivedV,
- typename DerivedF,
- typename DerivedE,
- typename DerivedN,
- typename DerivedUV,
- typename DerivedVD,
- typename DerivedFD,
- typename DerivedED
- >
- bool readPLY(
- const std::string& ply_file,
- Eigen::PlainObjectBase<DerivedV> & V,
- Eigen::PlainObjectBase<DerivedF> & F,
- Eigen::PlainObjectBase<DerivedE> & E,
- Eigen::PlainObjectBase<DerivedN> & N,
- Eigen::PlainObjectBase<DerivedUV> & UV,
- Eigen::PlainObjectBase<DerivedVD> & VD,
- std::vector<std::string> & VDheader,
- Eigen::PlainObjectBase<DerivedFD> & FD,
- std::vector<std::string> & FDheader,
- Eigen::PlainObjectBase<DerivedED> & ED,
- std::vector<std::string> & EDheader,
- std::vector<std::string> & comments
- );
- /// \overload
- template <
- typename DerivedV,
- typename DerivedF,
- typename DerivedN,
- typename DerivedUV,
- typename DerivedVD
- >
- bool readPLY(
- const std::string & filename,
- Eigen::PlainObjectBase<DerivedV> & V,
- Eigen::PlainObjectBase<DerivedF> & F,
- Eigen::PlainObjectBase<DerivedN> & N,
- Eigen::PlainObjectBase<DerivedUV> & UV,
- Eigen::PlainObjectBase<DerivedVD> & VD,
- std::vector<std::string> & Vheader
- );
- /// \overload
- template <
- typename DerivedV,
- typename DerivedF,
- typename DerivedE,
- typename DerivedN,
- typename DerivedUV
- >
- bool readPLY(
- const std::string & filename,
- Eigen::PlainObjectBase<DerivedV> & V,
- Eigen::PlainObjectBase<DerivedF> & F,
- Eigen::PlainObjectBase<DerivedE> & E,
- Eigen::PlainObjectBase<DerivedN> & N,
- Eigen::PlainObjectBase<DerivedUV> & UV
- );
- /// \overload
- template <
- typename DerivedV,
- typename DerivedF
- >
- bool readPLY(
- const std::string & filename,
- Eigen::PlainObjectBase<DerivedV> & V,
- Eigen::PlainObjectBase<DerivedF> & F
- );
- /// \overload
- template <
- typename DerivedV,
- typename DerivedF,
- typename DerivedE
- >
- bool readPLY(
- const std::string & filename,
- Eigen::PlainObjectBase<DerivedV> & V,
- Eigen::PlainObjectBase<DerivedF> & F,
- Eigen::PlainObjectBase<DerivedE> & E
- );
- /// \overload
- /// @param[in,out] fp pointer to ply file (will be closed)
- template <
- typename DerivedV,
- typename DerivedF
- >
- IGL_INLINE bool readPLY(
- FILE *fp,
- Eigen::PlainObjectBase<DerivedV> & V,
- Eigen::PlainObjectBase<DerivedF> & F
- );
- }
- #ifndef IGL_STATIC_LIBRARY
- # include "readPLY.cpp"
- #endif
- #endif
|