write_triangle_mesh.cpp 1022 B

123456789101112131415161718192021222324252627282930313233
  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. #include "write_triangle_mesh.h"
  9. #include "../write_triangle_mesh.h"
  10. #include "../pathinfo.h"
  11. #include "writeDAE.h"
  12. template <typename DerivedV, typename DerivedF>
  13. IGL_INLINE bool igl::xml::write_triangle_mesh(
  14. const std::string str,
  15. const Eigen::PlainObjectBase<DerivedV>& V,
  16. const Eigen::PlainObjectBase<DerivedF>& F,
  17. const bool ascii)
  18. {
  19. using namespace std;
  20. // dirname, basename, extension and filename
  21. string d,b,e,f;
  22. pathinfo(str,d,b,e,f);
  23. // Convert extension to lower case
  24. std::transform(e.begin(), e.end(), e.begin(), ::tolower);
  25. if(e == "dae")
  26. {
  27. return writeDAE(str,V,F);
  28. }else
  29. {
  30. return igl::write_triangle_mesh(str,V,F,ascii);
  31. }
  32. }