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