vec_mat_operations3.hpp 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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_E5F500D4618DBE7B51573B33821F
  5. #define BOOST_QVM_E5F500D4618DBE7B51573B33821F
  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==3 && mat_traits<A>::cols==3 &&
  22. vec_traits<B>::dim==3,
  23. deduce_vec2<A,B,3> >::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 a02 = mat_traits<A>::template read_element<0,2>(a);
  31. Ta const a10 = mat_traits<A>::template read_element<1,0>(a);
  32. Ta const a11 = mat_traits<A>::template read_element<1,1>(a);
  33. Ta const a12 = mat_traits<A>::template read_element<1,2>(a);
  34. Ta const a20 = mat_traits<A>::template read_element<2,0>(a);
  35. Ta const a21 = mat_traits<A>::template read_element<2,1>(a);
  36. Ta const a22 = mat_traits<A>::template read_element<2,2>(a);
  37. Tb const b0 = vec_traits<B>::template read_element<0>(b);
  38. Tb const b1 = vec_traits<B>::template read_element<1>(b);
  39. Tb const b2 = vec_traits<B>::template read_element<2>(b);
  40. typedef typename deduce_vec2<A,B,3>::type R;
  41. BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==3);
  42. R r;
  43. vec_traits<R>::template write_element<0>(r)=a00*b0+a01*b1+a02*b2;
  44. vec_traits<R>::template write_element<1>(r)=a10*b0+a11*b1+a12*b2;
  45. vec_traits<R>::template write_element<2>(r)=a20*b0+a21*b1+a22*b2;
  46. return r;
  47. }
  48. namespace
  49. sfinae
  50. {
  51. using ::boost::qvm::operator*;
  52. }
  53. namespace
  54. qvm_detail
  55. {
  56. template <int R,int C>
  57. struct mul_mv_defined;
  58. template <>
  59. struct
  60. mul_mv_defined<3,3>
  61. {
  62. static bool const value=true;
  63. };
  64. }
  65. template <class A,class B>
  66. BOOST_QVM_INLINE_OPERATIONS
  67. typename lazy_enable_if_c<
  68. mat_traits<B>::rows==3 && mat_traits<B>::cols==3 &&
  69. vec_traits<A>::dim==3,
  70. deduce_vec2<A,B,3> >::type
  71. operator*( A const & a, B const & b )
  72. {
  73. typedef typename vec_traits<A>::scalar_type Ta;
  74. typedef typename mat_traits<B>::scalar_type Tb;
  75. Ta const a0 = vec_traits<A>::template read_element<0>(a);
  76. Ta const a1 = vec_traits<A>::template read_element<1>(a);
  77. Ta const a2 = vec_traits<A>::template read_element<2>(a);
  78. Tb const b00 = mat_traits<B>::template read_element<0,0>(b);
  79. Tb const b01 = mat_traits<B>::template read_element<0,1>(b);
  80. Tb const b02 = mat_traits<B>::template read_element<0,2>(b);
  81. Tb const b10 = mat_traits<B>::template read_element<1,0>(b);
  82. Tb const b11 = mat_traits<B>::template read_element<1,1>(b);
  83. Tb const b12 = mat_traits<B>::template read_element<1,2>(b);
  84. Tb const b20 = mat_traits<B>::template read_element<2,0>(b);
  85. Tb const b21 = mat_traits<B>::template read_element<2,1>(b);
  86. Tb const b22 = mat_traits<B>::template read_element<2,2>(b);
  87. typedef typename deduce_vec2<A,B,3>::type R;
  88. BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==3);
  89. R r;
  90. vec_traits<R>::template write_element<0>(r)=a0*b00+a1*b10+a2*b20;
  91. vec_traits<R>::template write_element<1>(r)=a0*b01+a1*b11+a2*b21;
  92. vec_traits<R>::template write_element<2>(r)=a0*b02+a1*b12+a2*b22;
  93. return r;
  94. }
  95. namespace
  96. sfinae
  97. {
  98. using ::boost::qvm::operator*;
  99. }
  100. namespace
  101. qvm_detail
  102. {
  103. template <int R,int C>
  104. struct mul_vm_defined;
  105. template <>
  106. struct
  107. mul_vm_defined<3,3>
  108. {
  109. static bool const value=true;
  110. };
  111. }
  112. }
  113. }
  114. #endif