write_triangle_mesh.cpp 997 B

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