vec_mat_operations2.hpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #ifndef BOOST_QVM_GEN_VEC_MAT_OPERATIONS2_HPP_INCLUDED
  2. #define BOOST_QVM_GEN_VEC_MAT_OPERATIONS2_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==2 && mat_traits<A>::cols==2 &&
  17. vec_traits<B>::dim==2,
  18. deduce_vec2<A,B,2> >::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 a10 = mat_traits<A>::template read_element<1,0>(a);
  26. Ta const a11 = mat_traits<A>::template read_element<1,1>(a);
  27. Tb const b0 = vec_traits<B>::template read_element<0>(b);
  28. Tb const b1 = vec_traits<B>::template read_element<1>(b);
  29. typedef typename deduce_vec2<A,B,2>::type R;
  30. BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==2);
  31. R r;
  32. vec_traits<R>::template write_element<0>(r)=a00*b0+a01*b1;
  33. vec_traits<R>::template write_element<1>(r)=a10*b0+a11*b1;
  34. return r;
  35. }
  36. namespace
  37. sfinae
  38. {
  39. using ::boost::qvm::operator*;
  40. }
  41. namespace
  42. qvm_detail
  43. {
  44. template <int R,int C>
  45. struct mul_mv_defined;
  46. template <>
  47. struct
  48. mul_mv_defined<2,2>
  49. {
  50. static bool const value=true;
  51. };
  52. }
  53. template <class A,class B>
  54. BOOST_QVM_INLINE_OPERATIONS
  55. typename lazy_enable_if_c<
  56. mat_traits<B>::rows==2 && mat_traits<B>::cols==2 &&
  57. vec_traits<A>::dim==2,
  58. deduce_vec2<A,B,2> >::type
  59. operator*( A const & a, B const & b )
  60. {
  61. typedef typename vec_traits<A>::scalar_type Ta;
  62. typedef typename mat_traits<B>::scalar_type Tb;
  63. Ta const a0 = vec_traits<A>::template read_element<0>(a);
  64. Ta const a1 = vec_traits<A>::template read_element<1>(a);
  65. Tb const b00 = mat_traits<B>::template read_element<0,0>(b);
  66. Tb const b01 = mat_traits<B>::template read_element<0,1>(b);
  67. Tb const b10 = mat_traits<B>::template read_element<1,0>(b);
  68. Tb const b11 = mat_traits<B>::template read_element<1,1>(b);
  69. typedef typename deduce_vec2<A,B,2>::type R;
  70. BOOST_QVM_STATIC_ASSERT(vec_traits<R>::dim==2);
  71. R r;
  72. vec_traits<R>::template write_element<0>(r)=a0*b00+a1*b10;
  73. vec_traits<R>::template write_element<1>(r)=a0*b01+a1*b11;
  74. return r;
  75. }
  76. namespace
  77. sfinae
  78. {
  79. using ::boost::qvm::operator*;
  80. }
  81. namespace
  82. qvm_detail
  83. {
  84. template <int R,int C>
  85. struct mul_vm_defined;
  86. template <>
  87. struct
  88. mul_vm_defined<2,2>
  89. {
  90. static bool const value=true;
  91. };
  92. }
  93. } }
  94. #endif