from_cork_mesh.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #ifndef IGL_NO_CORK
  2. #include "from_cork_mesh.h"
  3. template <
  4. typename DerivedV,
  5. typename DerivedF>
  6. IGL_INLINE void igl::from_cork_mesh(
  7. const CorkTriMesh & mesh,
  8. Eigen::PlainObjectBase<DerivedV > & V,
  9. Eigen::PlainObjectBase<DerivedF > & F)
  10. {
  11. using namespace std;
  12. F.resize(mesh.n_triangles,3);
  13. V.resize(mesh.n_vertices,3);
  14. for(size_t v = 0;v<mesh.n_vertices;v++)
  15. {
  16. for(size_t c = 0;c<3;c++)
  17. {
  18. V(v,c) = mesh.vertices[v*3+c];
  19. }
  20. }
  21. for(size_t f = 0;f<mesh.n_triangles;f++)
  22. {
  23. for(size_t c = 0;c<3;c++)
  24. {
  25. F(f,c) = mesh.triangles[f*3+c];
  26. }
  27. }
  28. }
  29. #ifdef IGL_STATIC_LIBRARY
  30. // Explicit template specialization
  31. template void igl::from_cork_mesh<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(CorkTriMesh const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&);
  32. template void igl::from_cork_mesh<Eigen::Matrix<double, -1, 3, 0, -1, 3>, Eigen::Matrix<int, -1, 3, 0, -1, 3> >(CorkTriMesh const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, 3, 0, -1, 3> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 3, 0, -1, 3> >&);
  33. #endif
  34. #endif