writePLY.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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_WRITEPLY_H
  9. #define IGL_WRITEPLY_H
  10. #include "igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <string>
  13. namespace igl
  14. {
  15. // Write a mesh to a .ply file.
  16. //
  17. // Inputs:
  18. // filename path to .ply file
  19. // V #V by 3 list of vertex positions
  20. // F #F by 3 list of triangle indices
  21. // N #V by 3 list of vertex normals
  22. // UV #V by 2 list of vertex texture coordinates
  23. // Returns true iff success
  24. template <
  25. typename DerivedV,
  26. typename DerivedF,
  27. typename DerivedN,
  28. typename DerivedUV>
  29. IGL_INLINE bool writePLY(
  30. const std::string & filename,
  31. const Eigen::PlainObjectBase<DerivedV> & V,
  32. const Eigen::PlainObjectBase<DerivedF> & F,
  33. const Eigen::PlainObjectBase<DerivedN> & N,
  34. const Eigen::PlainObjectBase<DerivedUV> & UV,
  35. const bool ascii = true);
  36. template <
  37. typename DerivedV,
  38. typename DerivedF>
  39. IGL_INLINE bool writePLY(
  40. const std::string & filename,
  41. const Eigen::PlainObjectBase<DerivedV> & V,
  42. const Eigen::PlainObjectBase<DerivedF> & F,
  43. const bool ascii = true);
  44. }
  45. #ifndef IGL_STATIC_LIBRARY
  46. # include "writePLY.cpp"
  47. #endif
  48. #endif