readPLY.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2014 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_READPLY_H
  9. #define IGL_READPLY_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <string>
  13. #include <vector>
  14. namespace igl
  15. {
  16. // Read a mesh from a .ply file.
  17. //
  18. // Inputs:
  19. // filename path to .ply file
  20. // Outputs:
  21. // V #V by 3 list of vertex positions
  22. // F #F list of lists of triangle indices
  23. // N #V by 3 list of vertex normals
  24. // UV #V by 2 list of vertex texture coordinates
  25. // Returns true iff success
  26. template <
  27. typename Vtype,
  28. typename Ftype,
  29. typename Ntype,
  30. typename UVtype>
  31. IGL_INLINE bool readPLY(
  32. const std::string & filename,
  33. std::vector<std::vector<Vtype> > & V,
  34. std::vector<std::vector<Ftype> > & F,
  35. std::vector<std::vector<Ntype> > & N,
  36. std::vector<std::vector<UVtype> > & UV);
  37. template <
  38. typename DerivedV,
  39. typename DerivedF,
  40. typename DerivedN,
  41. typename DerivedUV>
  42. IGL_INLINE bool readPLY(
  43. const std::string & filename,
  44. Eigen::PlainObjectBase<DerivedV> & V,
  45. Eigen::PlainObjectBase<DerivedF> & F,
  46. Eigen::PlainObjectBase<DerivedN> & N,
  47. Eigen::PlainObjectBase<DerivedUV> & UV);
  48. }
  49. #ifndef IGL_STATIC_LIBRARY
  50. # include "readPLY.cpp"
  51. #endif
  52. #endif