ears.cpp 1.2 KB

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