is_border_vertex.h 711 B

12345678910111213141516171819202122232425262728293031323334353637
  1. //
  2. // IGL Lib - Simple C++ mesh library
  3. //
  4. // Copyright 2011, Daniele Panozzo. All rights reserved.
  5. #ifndef ISBORDERVERTEX_H
  6. #define ISBORDERVERTEX_H
  7. #include <Eigen/Core>
  8. #include <string>
  9. #include <vector>
  10. #include "tt.h"
  11. namespace igl
  12. {
  13. template<typename T>
  14. inline std::vector<bool> is_border_vertex(const T& V, const Eigen::MatrixXi& F)
  15. {
  16. Eigen::MatrixXi FF;
  17. igl::tt(V,F,FF);
  18. vector<bool> ret(V.rows());
  19. for(int i=0; i<ret.size();++i)
  20. ret[i] = false;
  21. for(int i=0; i<F.rows();++i)
  22. for(int j=0;j<F.cols();++j)
  23. if(FF(i,j) == -1)
  24. {
  25. ret[F(i,j)] = true;
  26. ret[F(i,(j+1)%3)] = true;
  27. }
  28. return ret;
  29. }
  30. }
  31. #endif