read.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef IGL_READ_H
  2. #define IGL_READ_H
  3. #include "igl_inline.h"
  4. #ifndef IGL_NO_EIGEN
  5. # include <Eigen/Core>
  6. #endif
  7. #include <string>
  8. #include <vector>
  9. // History:
  10. // return type changed from void to bool Alec 18 Sept 2011
  11. namespace igl
  12. {
  13. // read mesh from an ascii file with automatic detection of file format. supported: obj, off)
  14. // Templates:
  15. // Scalar type for positions and vectors (will be read as double and cast
  16. // to Scalar)
  17. // Index type for indices (will be read as int and cast to Index)
  18. // Inputs:
  19. // Inputs:
  20. // str path to .obj/.off file
  21. // Outputs:
  22. // V eigen double matrix #V by 3
  23. // F eigen int matrix #F by 3
  24. template <typename Scalar, typename Index>
  25. IGL_INLINE bool read(
  26. const std::string str,
  27. std::vector<std::vector<Scalar> > & V,
  28. std::vector<std::vector<Index> > & F);
  29. #ifndef IGL_NO_EIGEN
  30. template <typename DerivedV, typename DerivedF>
  31. IGL_INLINE bool read(
  32. const std::string str,
  33. Eigen::PlainObjectBase<DerivedV>& V,
  34. Eigen::PlainObjectBase<DerivedF>& F);
  35. #endif
  36. }
  37. #ifdef IGL_HEADER_ONLY
  38. # include "read.cpp"
  39. #endif
  40. #endif