]>
Commit | Line | Data |
---|---|---|
1e59de90 | 1 | // Copyright 2008-2022 Emil Dotchevski and Reverge Studios, Inc. |
92f5a8d4 | 2 | |
1e59de90 TL |
3 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
4 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | |
92f5a8d4 | 5 | |
f67539c2 TL |
6 | #ifndef BOOST_QVM_EF9152E42E4711DFB699737156D89593 |
7 | #define BOOST_QVM_EF9152E42E4711DFB699737156D89593 | |
92f5a8d4 TL |
8 | |
9 | #include <boost/qvm/quat_traits_defaults.hpp> | |
10 | #include <boost/qvm/deduce_quat.hpp> | |
11 | #include <boost/qvm/assert.hpp> | |
12 | #include "test_qvm.hpp" | |
13 | ||
14 | namespace | |
15 | test_qvm | |
16 | { | |
17 | template <class Tag,class T=float> | |
18 | struct | |
19 | quaternion | |
20 | { | |
21 | T a[4]; | |
22 | mutable T b[4]; | |
23 | ||
24 | explicit | |
25 | quaternion( T start=T(0), T step=T(0) ) | |
26 | { | |
27 | for( int i=0; i!=4; ++i,start+=step ) | |
28 | a[i]=b[i]=start; | |
29 | } | |
30 | }; | |
31 | ||
32 | template <class Tag1,class T1,class Tag2,class T2> | |
33 | void | |
34 | dump_ab( quaternion<Tag1,T1> const & a, quaternion<Tag2,T2> const & b ) | |
35 | { | |
36 | detail::dump_ab(a.a,b.a); | |
37 | } | |
38 | } | |
39 | ||
1e59de90 TL |
40 | namespace boost { namespace qvm { |
41 | ||
92f5a8d4 TL |
42 | template <class Tag,class T> |
43 | struct | |
44 | quat_traits< test_qvm::quaternion<Tag,T> >: | |
45 | quat_traits_defaults<test_qvm::quaternion<Tag,T>,T> | |
46 | { | |
47 | typedef quat_traits_defaults<test_qvm::quaternion<Tag,T>,T> base; | |
48 | ||
49 | template <int I> | |
50 | static | |
51 | typename base::scalar_type & | |
52 | write_element( typename base::quat_type & m ) | |
53 | { | |
54 | BOOST_QVM_STATIC_ASSERT(I>=0); | |
55 | BOOST_QVM_STATIC_ASSERT(I<4); | |
56 | return m.a[I]; | |
57 | } | |
58 | }; | |
59 | ||
60 | template <class Tag,class T> | |
61 | struct | |
62 | deduce_quat2<test_qvm::quaternion<Tag,T>,test_qvm::quaternion<Tag,T> > | |
63 | { | |
64 | typedef test_qvm::quaternion<Tag,T> type; | |
65 | }; | |
66 | } | |
67 | } | |
68 | ||
69 | namespace | |
70 | { | |
71 | struct Q1; | |
72 | struct Q2; | |
73 | struct Q3; | |
74 | } | |
75 | ||
76 | #endif |