ears.cpp 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #include "ears.h"
  2. #include "on_boundary.h"
  3. #include "find.h"
  4. #include "slice.h"
  5. #include "mat_min.h"
  6. #include <cassert>
  7. template <
  8. typename DerivedF,
  9. typename Derivedear,
  10. typename Derivedear_opp>
  11. IGL_INLINE void igl::ears(
  12. const Eigen::MatrixBase<DerivedF> & F,
  13. Eigen::PlainObjectBase<Derivedear> & ear,
  14. Eigen::PlainObjectBase<Derivedear_opp> & ear_opp)
  15. {
  16. assert(F.cols() == 3 && "F should contain triangles");
  17. Eigen::Array<bool,Eigen::Dynamic,3> B;
  18. {
  19. Eigen::Array<bool,Eigen::Dynamic,1> I;
  20. on_boundary(F,I,B);
  21. }
  22. find(B.rowwise().count() == 2,ear);
  23. Eigen::Array<bool,Eigen::Dynamic,3> Bear;
  24. slice(B,ear,1,Bear);
  25. Eigen::Array<bool,Eigen::Dynamic,1> M;
  26. mat_min(Bear,2,M,ear_opp);
  27. }
  28. #ifdef IGL_STATIC_LIBRARY
  29. // Explicit template instantiation
  30. // generated by autoexplicit.sh
  31. template void igl::ears<Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, 1, 0, -1, 1>, Eigen::Matrix<int, -1, 1, 0, -1, 1> >(Eigen::MatrixBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, 1, 0, -1, 1> >&);
  32. #endif