write.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #include "write.h"
  2. #include "writeOBJ.h"
  3. #include "writeOFF.h"
  4. #include <iostream>
  5. template <typename DerivedV, typename DerivedF>
  6. IGL_INLINE bool igl::write(
  7. const std::string str,
  8. const Eigen::PlainObjectBase<DerivedV>& V,
  9. const Eigen::PlainObjectBase<DerivedF>& F)
  10. {
  11. using namespace std;
  12. const char* p;
  13. for (p = str.c_str(); *p != '\0'; p++)
  14. ;
  15. while (*p != '.')
  16. p--;
  17. if (!strcmp(p, ".obj") || !strcmp(p, ".OBJ"))
  18. return igl::writeOBJ(str,V,F);
  19. if (!strcmp(p, ".off") || !strcmp(p, ".OFF"))
  20. return igl::writeOFF(str,V,F);
  21. cerr<<"^write Unsupported extension: "<<string(p)<<endl;
  22. return false;
  23. }
  24. #ifndef IGL_HEADER_ONLY
  25. // Explicit template specialization
  26. // generated by autoexplicit.sh
  27. template bool igl::write<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(std::basic_string<char, std::char_traits<char>, std::allocator<char> >, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&);
  28. #endif