vec_mat_operations3.hpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. #ifndef BOOST_QVM_GEN_VEC_MAT_OPERATIONS3_HPP_INCLUDED
  2. #define BOOST_QVM_GEN_VEC_MAT_OPERATIONS3_HPP_INCLUDED
  3. /// Copyright (c) 2008-2021 Emil Dotchevski and Reverge Studios, Inc.
  4. /// Distributed under the Boost Software License, Version 1.0. (See accompanying
  5. /// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  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 boost { namespace qvm {
  13. template <class A,class B>
  14. BOOST_QVM_INLINE_OPERATIONS
  15. typename lazy_enable_if_c<
  16. mat_traits<A>::rows==3 && mat_traits<A>::cols==3 &&
  17. vec_traits<B>::dim==3,
  18. deduce_vec2<A,B,3> >::type
  19. operator*( A const & a, B const & b )
  20. {
  21. typedef typename mat_traits<A>::scalar_type Ta;
  22. typedef typename vec_traits<B>::scalar_type Tb;
  23. Ta const a00 = mat_traits<A>::template read_element<0,0>(a);
  24. Ta const a01 = mat_traits<A>::template read_element<0,1>(a);
  25. Ta const a02 = mat_traits<A>::template read_element<0,2>(a);
  26. Ta const a10 = mat_traits<A>::template read_element<1,0>(a);
  27. Ta const a11 = mat_traits<A>::template read_element<1,1>(a);
  28. Ta const a12 = mat_traits<A>::template read_element<1,2>(a);
  29. Ta const a20 = mat_traits<A>::template read_element<2,0>(a);
  30. Ta const a21 = mat_traits<A>::template read_element<2,1>(a);
  31. Ta const a22 = mat_traits<A>::template read_element<2,2>(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. Tb const b2 = vec_traits<B>::template read_element<2>(b);
  35. typedef typename deduce_vec2<A,B,3>::type R;
  36. BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==3);
  37. R r;
  38. vec_traits<R>::template write_element<0>(r)=a00*b0+a01*b1+a02*b2;
  39. vec_traits<R>::template write_element<1>(r)=a10*b0+a11*b1+a12*b2;
  40. vec_traits<R>::template write_element<2>(r)=a20*b0+a21*b1+a22*b2;
  41. return r;
  42. }
  43. namespace
  44. sfinae
  45. {
  46. using ::boost::qvm::operator*;
  47. }
  48. namespace
  49. qvm_detail
  50. {
  51. template <int R,int C>
  52. struct mul_mv_defined;
  53. template <>
  54. struct
  55. mul_mv_defined<3,3>
  56. {
  57. static bool const value=true;
  58. };
  59. }
  60. template <class A,class B>
  61. BOOST_QVM_INLINE_OPERATIONS
  62. typename lazy_enable_if_c<
  63. mat_traits<B>::rows==3 && mat_traits<B>::cols==3 &&
  64. vec_traits<A>::dim==3,
  65. deduce_vec2<A,B,3> >::type
  66. operator*( A const & a, B const & b )
  67. {
  68. typedef typename vec_traits<A>::scalar_type Ta;
  69. typedef typename mat_traits<B>::scalar_type Tb;
  70. Ta const a0 = vec_traits<A>::template read_element<0>(a);
  71. Ta const a1 = vec_traits<A>::template read_element<1>(a);
  72. Ta const a2 = vec_traits<A>::template read_element<2>(a);
  73. Tb const b00 = mat_traits<B>::template read_element<0,0>(b);
  74. Tb const b01 = mat_traits<B>::template read_element<0,1>(b);
  75. Tb const b02 = mat_traits<B>::template read_element<0,2>(b);
  76. Tb const b10 = mat_traits<B>::template read_element<1,0>(b);
  77. Tb const b11 = mat_traits<B>::template read_element<1,1>(b);
  78. Tb const b12 = mat_traits<B>::template read_element<1,2>(b);
  79. Tb const b20 = mat_traits<B>::template read_element<2,0>(b);
  80. Tb const b21 = mat_traits<B>::template read_element<2,1>(b);
  81. Tb const b22 = mat_traits<B>::template read_element<2,2>(b);
  82. typedef typename deduce_vec2<A,B,3>::type R;
  83. BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==3);
  84. R r;
  85. vec_traits<R>::template write_element<0>(r)=a0*b00+a1*b10+a2*b20;
  86. vec_traits<R>::template write_element<1>(r)=a0*b01+a1*b11+a2*b21;
  87. vec_traits<R>::template write_element<2>(r)=a0*b02+a1*b12+a2*b22;
  88. return r;
  89. }
  90. namespace
  91. sfinae
  92. {
  93. using ::boost::qvm::operator*;
  94. }
  95. namespace
  96. qvm_detail
  97. {
  98. template <int R,int C>
  99. struct mul_vm_defined;
  100. template <>
  101. struct
  102. mul_vm_defined<3,3>
  103. {
  104. static bool const value=true;
  105. };
  106. }
  107. } }
  108. #endif