write_triangle_mesh.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2016 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_XML_WRITE_TRIANGLE_MESH_H
  9. #define IGL_XML_WRITE_TRIANGLE_MESH_H
  10. #include "../igl_inline.h"
  11. #include <Eigen/Core>
  12. #include <string>
  13. namespace igl
  14. {
  15. namespace xml
  16. {
  17. // write mesh to a file with automatic detection of file format. supported:
  18. // dae, or any of the formats supported by igl::write_triangle_mesh
  19. //
  20. // Templates:
  21. // Scalar type for positions and vectors (will be read as double and cast
  22. // to Scalar)
  23. // Index type for indices (will be read as int and cast to Index)
  24. // Inputs:
  25. // str path to file
  26. // V eigen double matrix #V by 3
  27. // F eigen int matrix #F by 3
  28. // Returns true iff success
  29. template <typename DerivedV, typename DerivedF>
  30. IGL_INLINE bool write_triangle_mesh(
  31. const std::string str,
  32. const Eigen::PlainObjectBase<DerivedV>& V,
  33. const Eigen::PlainObjectBase<DerivedF>& F,
  34. const bool ascii = true);
  35. }
  36. }
  37. #ifndef IGL_STATIC_LIBRARY
  38. # include "write_triangle_mesh.cpp"
  39. #endif
  40. #endif