read.h 1.2 KB

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