from_cork_mesh.cpp 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. // This file is part of libigl, a simple c++ geometry processing library.
  2. //
  3. // Copyright (C) 2015 Alec Jacobson <alecjacobson@gmail.com>
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public License
  6. // v. 2.0. If a copy of the MPL was not distributed with this file, You can
  7. // obtain one at http://mozilla.org/MPL/2.0/.
  8. #ifndef IGL_NO_CORK
  9. #include "from_cork_mesh.h"
  10. template <
  11. typename DerivedV,
  12. typename DerivedF>
  13. IGL_INLINE void igl::from_cork_mesh(
  14. const CorkTriMesh & mesh,
  15. Eigen::PlainObjectBase<DerivedV > & V,
  16. Eigen::PlainObjectBase<DerivedF > & F)
  17. {
  18. using namespace std;
  19. F.resize(mesh.n_triangles,3);
  20. V.resize(mesh.n_vertices,3);
  21. for(size_t v = 0;v<mesh.n_vertices;v++)
  22. {
  23. for(size_t c = 0;c<3;c++)
  24. {
  25. V(v,c) = mesh.vertices[v*3+c];
  26. }
  27. }
  28. for(size_t f = 0;f<mesh.n_triangles;f++)
  29. {
  30. for(size_t c = 0;c<3;c++)
  31. {
  32. F(f,c) = mesh.triangles[f*3+c];
  33. }
  34. }
  35. }
  36. #ifdef IGL_STATIC_LIBRARY
  37. // Explicit template specialization
  38. 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> >&);
  39. 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> >&);
  40. #endif
  41. #endif