]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/rotx_mat_test.cpp
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / libs / qvm / test / rotx_mat_test.cpp
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/mat_operations.hpp>
7 #include <boost/qvm/mat.hpp>
8 #include "test_qvm_matrix.hpp"
9 #include "gold.hpp"
10
11 namespace
12 {
13 template <int Dim>
14 void
15 test()
16 {
17 using namespace boost::qvm;
18 for( float r=0; r<6.28f; r+=0.5f )
19 {
20 test_qvm::matrix<M1,Dim,Dim> const m1=rotx_mat<Dim>(r);
21 test_qvm::rotation_x(m1.b,r);
22 BOOST_QVM_TEST_CLOSE(m1.a,m1.b,0.000001f);
23 test_qvm::matrix<M1,Dim,Dim> m2(42,1);
24 set_rotx(m2,r);
25 test_qvm::rotation_x(m2.b,r);
26 BOOST_QVM_TEST_CLOSE(m2.a,m2.b,0.000001f);
27 test_qvm::matrix<M1,Dim,Dim> m3(42,1);
28 test_qvm::matrix<M1,Dim,Dim> r1=m3*m1;
29 rotate_x(m3,r);
30 BOOST_QVM_TEST_EQ(m3.a,r1.a);
31 }
32 rotx_mat<Dim>(0.0f)+rotx_mat<Dim>(0.0f);
33 -rotx_mat<Dim>(0.0f);
34 }
35 }
36
37 int
38 main()
39 {
40 test<3>();
41 test<4>();
42 test<5>();
43 return boost::report_errors();
44 }