triangles_from_strip.cpp 575 B

1234567891011121314151617181920212223242526272829
  1. #include "triangles_from_strip.h"
  2. #include <iostream>
  3. template <typename DerivedS, typename DerivedF>
  4. IGL_INLINE void igl::triangles_from_strip(
  5. const Eigen::MatrixBase<DerivedS>& S,
  6. Eigen::PlainObjectBase<DerivedF>& F)
  7. {
  8. using namespace std;
  9. F.resize(S.size()-2,3);
  10. for(int s = 0;s < S.size()-2;s++)
  11. {
  12. if(s%2 == 0)
  13. {
  14. F(s,0) = S(s+2);
  15. F(s,1) = S(s+1);
  16. F(s,2) = S(s+0);
  17. }else
  18. {
  19. F(s,0) = S(s+0);
  20. F(s,1) = S(s+1);
  21. F(s,2) = S(s+2);
  22. }
  23. }
  24. }
  25. #ifdef IGL_STATIC_LIBRARY
  26. // Explicit template specialization
  27. #endif