| 1 | // Copyright 2008-2022 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 | #ifdef BOOST_QVM_TEST_SINGLE_HEADER |
| 7 | # include BOOST_QVM_TEST_SINGLE_HEADER |
| 8 | #else |
| 9 | # include <boost/qvm/mat_operations.hpp> |
| 10 | # include <boost/qvm/mat.hpp> |
| 11 | #endif |
| 12 | |
| 13 | #include "test_qvm_matrix.hpp" |
| 14 | #include "gold.hpp" |
| 15 | |
| 16 | namespace |
| 17 | { |
| 18 | template <int Dim> |
| 19 | void |
| 20 | test() |
| 21 | { |
| 22 | using namespace boost::qvm; |
| 23 | for( float r=0; r<6.28f; r+=0.5f ) |
| 24 | { |
| 25 | test_qvm::matrix<M1,Dim,Dim> const m1=rotx_mat<Dim>(r); |
| 26 | test_qvm::rotation_x(m1.b,r); |
| 27 | BOOST_QVM_TEST_CLOSE(m1.a,m1.b,0.001f); |
| 28 | test_qvm::matrix<M1,Dim,Dim> m2(42,1); |
| 29 | set_rotx(m2,r); |
| 30 | test_qvm::rotation_x(m2.b,r); |
| 31 | BOOST_QVM_TEST_CLOSE(m2.a,m2.b,0.001f); |
| 32 | test_qvm::matrix<M1,Dim,Dim> m3(42,1); |
| 33 | test_qvm::matrix<M1,Dim,Dim> r1=m3*m1; |
| 34 | rotate_x(m3,r); |
| 35 | BOOST_QVM_TEST_CLOSE(m3.a,r1.a,0.001f); |
| 36 | } |
| 37 | rotx_mat<Dim>(0.0f)+rotx_mat<Dim>(0.0f); |
| 38 | -rotx_mat<Dim>(0.0f); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | int |
| 43 | main() |
| 44 | { |
| 45 | test<3>(); |
| 46 | test<4>(); |
| 47 | test<5>(); |
| 48 | return boost::report_errors(); |
| 49 | } |
| 50 | |