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