00001
00002
00003
00004
00005
00006
00007
00008
00013 #ifndef quaternion_promotions_h
00014 #define quaternion_promotions_h
00015
00016 #include <cml/et/scalar_promotions.h>
00017 #include <cml/vector/vector_promotions.h>
00018
00019 namespace cml {
00020 namespace et {
00021
00022
00023 template<class LeftT, class RightT> struct QuaternionPromote;
00024
00026 template<typename E1, class AT1, typename E2, class AT2, class OT, class CT>
00027 struct QuaternionPromote<
00028 cml::quaternion<E1,AT1,OT,CT>,
00029 cml::quaternion<E2,AT2,OT,CT>
00030 >
00031 {
00032
00033 typedef typename VectorPromote<
00034 typename cml::quaternion<E1,AT1,OT,CT>::vector_type,
00035 typename cml::quaternion<E2,AT2,OT,CT>::vector_type
00036 >::type promoted_vector;
00037
00038
00039 typedef typename promoted_vector::value_type value_type;
00040 typedef typename promoted_vector::storage_type storage_type;
00041
00042
00043 typedef cml::quaternion<value_type,storage_type,OT,CT> type;
00044
00045
00046 typedef typename type::temporary_type temporary_type;
00047 };
00048
00055 template < class Quat1_T, class Quat2_T >
00056 struct QuaternionPromote2
00057 {
00058 typedef typename QuaternionPromote<
00059 typename Quat1_T::temporary_type, typename Quat2_T::temporary_type
00060 >::temporary_type temporary_type;
00061 typedef typename temporary_type::value_type value_type;
00062 };
00063
00065 template < class Quat1_T, class Quat2_T, class Quat3_T >
00066 struct QuaternionPromote3
00067 {
00068 typedef typename QuaternionPromote<
00069 typename Quat1_T::temporary_type,
00070 typename QuaternionPromote<
00071 typename Quat2_T::temporary_type, typename Quat3_T::temporary_type
00072 >::temporary_type
00073 >::temporary_type temporary_type;
00074 typedef typename temporary_type::value_type value_type;
00075 };
00076
00078 template < class Quat1_T, class Quat2_T, class Quat3_T, class Quat4_T >
00079 struct QuaternionPromote4
00080 {
00081 typedef typename QuaternionPromote<
00082 typename Quat1_T::temporary_type,
00083 typename QuaternionPromote<
00084 typename Quat2_T::temporary_type,
00085 typename QuaternionPromote<
00086 typename Quat3_T::temporary_type,
00087 typename Quat4_T::temporary_type
00088 >::temporary_type
00089 >::temporary_type
00090 >::temporary_type temporary_type;
00091 typedef typename temporary_type::value_type value_type;
00092 };
00093
00095 template<typename E, class AT, class OT, class CT, typename S>
00096 struct QuaternionPromote<cml::quaternion<E,AT,OT,CT>, S>
00097 {
00098
00099 typedef typename VectorPromote<
00100 typename quaternion<E,AT,OT,CT>::vector_type, S
00101 >::type promoted_vector;
00102
00103
00104 typedef typename promoted_vector::value_type value_type;
00105 typedef typename promoted_vector::storage_type storage_type;
00106
00107
00108 typedef cml::quaternion<value_type,storage_type,OT,CT> type;
00109
00110
00111 typedef typename type::temporary_type temporary_type;
00112 };
00113
00115 template<class S, typename E, class AT, class OT, class CT>
00116 struct QuaternionPromote<S, cml::quaternion<E,AT,OT,CT> >
00117 {
00118
00119 typedef typename VectorPromote<
00120 S, typename quaternion<E,AT,OT,CT>::vector_type
00121 >::type promoted_vector;
00122
00123
00124 typedef typename promoted_vector::value_type value_type;
00125 typedef typename promoted_vector::storage_type storage_type;
00126
00127
00128 typedef cml::quaternion<value_type,storage_type,OT,CT> type;
00129
00130
00131 typedef typename type::temporary_type temporary_type;
00132 };
00133
00134 }
00135 }
00136
00137 #endif
00138
00139
00140