read.cpp 571 B

123456789101112131415161718192021222324
  1. #include "read.h"
  2. #include "readOBJ.h"
  3. #include "readOFF.h"
  4. IGL_INLINE bool igl::read(const std::string str, Eigen::MatrixXd& V, Eigen::MatrixXi& F)
  5. {
  6. const char* p;
  7. for (p = str.c_str(); *p != '\0'; p++)
  8. ;
  9. while (*p != '.')
  10. p--;
  11. if (!strcmp(p, ".obj") || !strcmp(p, ".OBJ"))
  12. {
  13. return igl::readOBJ(str,V,F);
  14. }else if (!strcmp(p, ".off") || !strcmp(p, ".OFF"))
  15. {
  16. return igl::readOFF(str,V,F);
  17. }else
  18. {
  19. fprintf(stderr,"read() does not recognize extension: %s\n",p);
  20. return false;
  21. }
  22. }