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