is_border_vertex.h 799 B

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