vec_mat_operations2.hpp 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. //Copyright (c) 2008-2017 Emil Dotchevski and Reverge Studios, Inc.
  2. //Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #ifndef BOOST_QVM_48D38F75E6D91D2AE5C0F72B78818744
  5. #define BOOST_QVM_48D38F75E6D91D2AE5C0F72B78818744
  6. //This file was generated by a program. Do not edit manually.
  7. #include <boost/qvm/deduce_vec.hpp>
  8. #include <boost/qvm/enable_if.hpp>
  9. #include <boost/qvm/inline.hpp>
  10. #include <boost/qvm/mat_traits.hpp>
  11. #include <boost/qvm/vec_traits.hpp>
  12. namespace
  13. boost
  14. {
  15. namespace
  16. qvm
  17. {
  18. template <class A,class B>
  19. BOOST_QVM_INLINE_OPERATIONS
  20. typename lazy_enable_if_c<
  21. mat_traits<A>::rows==2 && mat_traits<A>::cols==2 &&
  22. vec_traits<B>::dim==2,
  23. deduce_vec2<A,B,2> >::type
  24. operator*( A const & a, B const & b )
  25. {
  26. typedef typename mat_traits<A>::scalar_type Ta;
  27. typedef typename vec_traits<B>::scalar_type Tb;
  28. Ta const a00 = mat_traits<A>::template read_element<0,0>(a);
  29. Ta const a01 = mat_traits<A>::template read_element<0,1>(a);
  30. Ta const a10 = mat_traits<A>::template read_element<1,0>(a);
  31. Ta const a11 = mat_traits<A>::template read_element<1,1>(a);
  32. Tb const b0 = vec_traits<B>::template read_element<0>(b);
  33. Tb const b1 = vec_traits<B>::template read_element<1>(b);
  34. typedef typename deduce_vec2<A,B,2>::type R;
  35. BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==2);
  36. R r;
  37. vec_traits<R>::template write_element<0>(r)=a00*b0+a01*b1;
  38. vec_traits<R>::template write_element<1>(r)=a10*b0+a11*b1;
  39. return r;
  40. }
  41. namespace
  42. sfinae
  43. {
  44. using ::boost::qvm::operator*;
  45. }
  46. namespace
  47. qvm_detail
  48. {
  49. template <int R,int C>
  50. struct mul_mv_defined;
  51. template <>
  52. struct
  53. mul_mv_defined<2,2>
  54. {
  55. static bool const value=true;
  56. };
  57. }
  58. template <class A,class B>
  59. BOOST_QVM_INLINE_OPERATIONS
  60. typename lazy_enable_if_c<
  61. mat_traits<B>::rows==2 && mat_traits<B>::cols==2 &&
  62. vec_traits<A>::dim==2,
  63. deduce_vec2<A,B,2> >::type
  64. operator*( A const & a, B const & b )
  65. {
  66. typedef typename vec_traits<A>::scalar_type Ta;
  67. typedef typename mat_traits<B>::scalar_type Tb;
  68. Ta const a0 = vec_traits<A>::template read_element<0>(a);
  69. Ta const a1 = vec_traits<A>::template read_element<1>(a);
  70. Tb const b00 = mat_traits<B>::template read_element<0,0>(b);
  71. Tb const b01 = mat_traits<B>::template read_element<0,1>(b);
  72. Tb const b10 = mat_traits<B>::template read_element<1,0>(b);
  73. Tb const b11 = mat_traits<B>::template read_element<1,1>(b);
  74. typedef typename deduce_vec2<A,B,2>::type R;
  75. BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==2);
  76. R r;
  77. vec_traits<R>::template write_element<0>(r)=a0*b00+a1*b10;
  78. vec_traits<R>::template write_element<1>(r)=a0*b01+a1*b11;
  79. return r;
  80. }
  81. namespace
  82. sfinae
  83. {
  84. using ::boost::qvm::operator*;
  85. }
  86. namespace
  87. qvm_detail
  88. {
  89. template <int R,int C>
  90. struct mul_vm_defined;
  91. template <>
  92. struct
  93. mul_vm_defined<2,2>
  94. {
  95. static bool const value=true;
  96. };
  97. }
  98. }
  99. }
  100. #endif