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