]>
Commit | Line | Data |
---|---|---|
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/vec_operations.hpp> | |
10 | # include <boost/qvm/vec.hpp> | |
11 | # include <boost/qvm/map_mat_vec.hpp> | |
12 | #endif | |
13 | ||
14 | #include "test_qvm_matrix.hpp" | |
15 | #include "test_qvm_vector.hpp" | |
16 | #include "gold.hpp" | |
17 | ||
18 | namespace | |
19 | { | |
20 | template <int R, int C> | |
21 | void | |
22 | test() | |
23 | { | |
24 | using namespace boost::qvm; | |
25 | test_qvm::matrix<M1,R,C> x(42,1); | |
26 | test_qvm::vector<V1,C-1> y=translation(x); | |
27 | for( int i=0; i!=C-1; ++i ) | |
28 | y.b[i]=x.a[i][C-1]; | |
29 | BOOST_QVM_TEST_EQ(y.a,y.b); | |
30 | translation(x) *= 2; | |
31 | for( int i=0; i!=C-1; ++i ) | |
32 | x.b[i][C-1] *= 2; | |
33 | BOOST_QVM_TEST_EQ(x.a,x.b); | |
34 | translation(x) + translation(x); | |
35 | -translation(x); | |
36 | } | |
37 | } | |
38 | ||
39 | int | |
40 | main() | |
41 | { | |
42 | test<3,3>(); | |
43 | test<2,3>(); | |
44 | test<4,4>(); | |
45 | test<3,4>(); | |
46 | test<5,5>(); | |
47 | test<4,5>(); | |
48 | return boost::report_errors(); | |
49 | } |