]>
Dogcows Code - chaz/yoink/blob - cml/quaternion/quaternion_dot.h
1 /* -*- C++ -*- ------------------------------------------------------------
3 Copyright (c) 2007 Jesse Anders and Demian Nave http://cmldev.net/
5 The Configurable Math Library (CML) is distributed under the terms of the
6 Boost Software License, v1.0 (see cml/LICENSE for details).
8 *-----------------------------------------------------------------------*/
13 #ifndef quaternion_dot_h
14 #define quaternion_dot_h
16 #include <cml/vector/vector_products.h>
17 #include <cml/quaternion/quaternion_expr.h>
22 template<class LeftT
, class RightT
> inline
23 typename
detail::DotPromote
<LeftT
,RightT
>::promoted_scalar
24 quaternion_dot(const LeftT
& p
, const RightT
& q
)
26 return p
[0]*q
[0] + p
[1]*q
[1] + p
[2]*q
[2] + p
[3]*q
[3];
31 template<typename E1
, class AT1
, typename E2
, class AT2
, class OT
, class CT
>
32 inline typename
detail::DotPromote
<
33 quaternion
<E1
,AT1
,OT
,CT
>, quaternion
<E2
,AT2
,OT
,CT
>
35 dot(const quaternion
<E1
,AT1
,OT
,CT
>& p
,
36 const quaternion
<E2
,AT2
,OT
,CT
>& q
)
38 return detail::quaternion_dot(p
,q
);
41 template<typename E
, class AT
, class OT
, class CT
, class XprT
>
42 inline typename
detail::DotPromote
<
43 quaternion
<E
,AT
,OT
,CT
>, et::QuaternionXpr
<XprT
>
45 dot(const quaternion
<E
,AT
,OT
,CT
>& p
, QUATXPR_ARG_TYPE q
)
47 return detail::quaternion_dot(p
,q
);
50 template<class XprT
, typename E
, class AT
, class OT
, class CT
>
51 inline typename
detail::DotPromote
<
52 et::QuaternionXpr
<XprT
>, quaternion
<E
,AT
,OT
,CT
>
54 dot(QUATXPR_ARG_TYPE p
, const quaternion
<E
,AT
,OT
,CT
>& q
)
56 return detail::quaternion_dot(p
,q
);
59 template<class XprT1
, class XprT2
> inline
60 typename
detail::DotPromote
<
61 et::QuaternionXpr
<XprT1
>, et::QuaternionXpr
<XprT2
>
63 dot(QUATXPR_ARG_TYPE_N(1) p
, QUATXPR_ARG_TYPE_N(2) q
)
65 return detail::quaternion_dot(p
,q
);
72 // -------------------------------------------------------------------------
This page took 0.035176 seconds and 4 git commands to generate.