• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
test()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=roty_quat(r);
22             test_qvm::matrix<M1,3,3> m1=convert_to< test_qvm::matrix<M1,3,3> >(q1);
23             test_qvm::rotation_y(m1.b,r);
24             BOOST_QVM_TEST_CLOSE(m1.a,m1.b,0.000001f);
25             test_qvm::quaternion<Q2> q2(42,1);
26             set_roty(q2,r);
27             test_qvm::matrix<M1,3,3> m2=convert_to< test_qvm::matrix<M1,3,3> >(q2);
28             test_qvm::rotation_y(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_y(q3,r);
33             BOOST_QVM_TEST_EQ(q3.a,r1.a);
34             }
35         roty_quat(0.0f)+roty_quat(0.0f);
36         -roty_quat(0.0f);
37         }
38     }
39 
40 int
main()41 main()
42     {
43     test();
44     return boost::report_errors();
45     }
46