]>
Commit | Line | Data |
---|---|---|
3a9019d9 FG |
1 | //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.\r |
2 | \r | |
3 | //Distributed under the Boost Software License, Version 1.0. (See accompanying\r | |
4 | //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)\r | |
5 | \r | |
6 | #include <boost/qvm/quat_operations.hpp>\r | |
7 | #include <boost/qvm/mat_operations.hpp>\r | |
8 | #include "test_qvm_quaternion.hpp"\r | |
9 | #include "test_qvm_matrix.hpp"\r | |
10 | #include "gold.hpp"\r | |
11 | \r | |
12 | namespace\r | |
13 | {\r | |
14 | template <class T,class U> struct same_type_tester;\r | |
15 | template <class T> struct same_type_tester<T,T> { };\r | |
16 | template <class T,class U> void test_same_type( T, U ) { same_type_tester<T,U>(); }\r | |
17 | \r | |
18 | void\r | |
19 | test()\r | |
20 | {\r | |
21 | using namespace boost::qvm;\r | |
22 | for( float a=0; a<6.28f; a+=0.2f )\r | |
23 | {\r | |
24 | test_qvm::quaternion<Q1> const qx=rotx_quat(a);\r | |
25 | test_qvm::quaternion<Q1> const qy=roty_quat(a);\r | |
26 | test_qvm::quaternion<Q1> const qz=rotz_quat(a);\r | |
27 | test_qvm::quaternion<Q1> q1=identity_quat<float>();\r | |
28 | q1 *= qx;\r | |
29 | q1 *= qy;\r | |
30 | q1 *= qref(qz);\r | |
31 | test_qvm::matrix<M1,3,3> const mx=rotx_mat<3>(a);\r | |
32 | test_qvm::matrix<M1,3,3> const my=roty_mat<3>(a);\r | |
33 | test_qvm::matrix<M1,3,3> const mz=rotz_mat<3>(a);\r | |
34 | test_qvm::matrix<M1,3,3> const m=mx*my*mz;\r | |
35 | test_qvm::quaternion<Q1> const q2=convert_to< test_qvm::quaternion<Q1> >(m);\r | |
36 | BOOST_QVM_TEST_CLOSE_QUAT(q1.a,q2.a,0.00001f);\r | |
37 | }\r | |
38 | }\r | |
39 | }\r | |
40 | \r | |
41 | int\r | |
42 | main()\r | |
43 | {\r | |
44 | test();\r | |
45 | return boost::report_errors();\r | |
46 | }\r |