]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/test_qvm_quaternion.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / qvm / test / test_qvm_quaternion.hpp
1 //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
2
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)
5
6 #ifndef UUID_EF9152E42E4711DFB699737156D89593
7 #define UUID_EF9152E42E4711DFB699737156D89593
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
40 namespace
41 boost
42 {
43 namespace
44 qvm
45 {
46 template <class Tag,class T>
47 struct
48 quat_traits< test_qvm::quaternion<Tag,T> >:
49 quat_traits_defaults<test_qvm::quaternion<Tag,T>,T>
50 {
51 typedef quat_traits_defaults<test_qvm::quaternion<Tag,T>,T> base;
52
53 template <int I>
54 static
55 typename base::scalar_type &
56 write_element( typename base::quat_type & m )
57 {
58 BOOST_QVM_STATIC_ASSERT(I>=0);
59 BOOST_QVM_STATIC_ASSERT(I<4);
60 return m.a[I];
61 }
62 };
63
64 template <class Tag,class T>
65 struct
66 deduce_quat2<test_qvm::quaternion<Tag,T>,test_qvm::quaternion<Tag,T> >
67 {
68 typedef test_qvm::quaternion<Tag,T> type;
69 };
70 }
71 }
72
73 namespace
74 {
75 struct Q1;
76 struct Q2;
77 struct Q3;
78 }
79
80 #endif