]>
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 <boost/qvm/quat.hpp>\r | |
9 | #include "test_qvm_quaternion.hpp"\r | |
10 | #include "test_qvm_matrix.hpp"\r | |
11 | #include "gold.hpp"\r | |
12 | \r | |
13 | namespace\r | |
14 | {\r | |
15 | void\r | |
16 | test()\r | |
17 | {\r | |
18 | using namespace boost::qvm;\r | |
19 | for( float r=0; r<6.28f; r+=0.5f )\r | |
20 | {\r | |
21 | test_qvm::quaternion<Q1> q1=rotz_quat(r);\r | |
22 | test_qvm::matrix<M1,3,3> m1=convert_to< test_qvm::matrix<M1,3,3> >(q1);\r | |
23 | test_qvm::rotation_z(m1.b,r);\r | |
24 | BOOST_QVM_TEST_CLOSE(m1.a,m1.b,0.000001f);\r | |
25 | test_qvm::quaternion<Q2> q2(42,1);\r | |
26 | set_rotz(q2,r);\r | |
27 | test_qvm::matrix<M1,3,3> m2=convert_to< test_qvm::matrix<M1,3,3> >(q2);\r | |
28 | test_qvm::rotation_z(m2.b,r);\r | |
29 | BOOST_QVM_TEST_CLOSE(m2.a,m2.b,0.000001f);\r | |
30 | test_qvm::quaternion<Q1> q3(42,1);\r | |
31 | test_qvm::quaternion<Q1> r1=q3*q1;\r | |
32 | rotate_z(q3,r);\r | |
33 | BOOST_QVM_TEST_EQ(q3.a,r1.a);\r | |
34 | }\r | |
35 | rotz_quat(0.0f)+rotz_quat(0.0f);\r | |
36 | -rotz_quat(0.0f);\r | |
37 | }\r | |
38 | }\r | |
39 | \r | |
40 | int\r | |
41 | main()\r | |
42 | {\r | |
43 | test();\r | |
44 | return boost::report_errors();\r | |
45 | }\r |