concat.cpp 751 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #include "concat.h"
  2. #include <cstdio>
  3. template <typename T>
  4. IGL_INLINE void igl::concat(
  5. const T A,
  6. const T B,
  7. const bool horiz,
  8. T& O)
  9. {
  10. if (horiz)
  11. {
  12. // O = [A,B]
  13. assert(A.rows() == B.rows());
  14. O = T(A.rows(),A.cols()+B.cols());
  15. O << A,B;
  16. }
  17. else
  18. {
  19. // O = [A;B]
  20. assert(A.cols() == B.cols());
  21. O = T(A.rows()+B.rows(),A.cols());
  22. O << A,B;
  23. }
  24. }
  25. template <typename T>
  26. IGL_INLINE T igl::concat(
  27. const T A,
  28. const T B,
  29. bool horiz
  30. )
  31. {
  32. T O = T(1,1);
  33. concat(A,B,horiz,O);
  34. return O;
  35. }
  36. #ifndef IGL_HEADER_ONLY
  37. // Explicit template specialization
  38. #endif