isolines_map.cpp 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. #include "isolines_map.h"
  2. #include <iostream>
  3. template <
  4. typename DerivedCM,
  5. typename Derivediso_color,
  6. typename DerivedICM
  7. >
  8. IGL_INLINE void igl::isolines_map(
  9. const Eigen::MatrixBase<DerivedCM> & CM,
  10. const Eigen::MatrixBase<Derivediso_color> & iso_color,
  11. const int interval_thickness,
  12. const int iso_thickness,
  13. Eigen::PlainObjectBase<DerivedICM> & ICM)
  14. {
  15. ICM.resize(CM.rows()*interval_thickness+(CM.rows()-1)*iso_thickness,3);
  16. {
  17. int k = 0;
  18. for(int c = 0;c<CM.rows();c++)
  19. {
  20. for(int i = 0;i<interval_thickness;i++)
  21. {
  22. ICM.row(k++) = CM.row(c);
  23. }
  24. if(c+1 != CM.rows())
  25. {
  26. for(int i = 0;i<iso_thickness;i++)
  27. {
  28. ICM.row(k++) = iso_color;
  29. }
  30. }
  31. }
  32. assert(k == ICM.rows());
  33. }
  34. }
  35. template <
  36. typename DerivedCM,
  37. typename DerivedICM
  38. >
  39. IGL_INLINE void igl::isolines_map(
  40. const Eigen::MatrixBase<DerivedCM> & CM,
  41. Eigen::PlainObjectBase<DerivedICM> & ICM)
  42. {
  43. return isolines_map(
  44. CM, Eigen::Matrix<typename DerivedCM::Scalar,1,3>(0,0,0), 10, 1, ICM);
  45. }
  46. #ifdef IGL_STATIC_LIBRARY
  47. // Explicit template instantiation
  48. template void igl::isolines_map<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1> >(Eigen::MatrixBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&);
  49. #endif