• 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/vec_operations.hpp>
7 #include <boost/qvm/vec_access.hpp>
8 #include <boost/qvm/mat_access.hpp>
9 #include <boost/qvm/vec_operations3.hpp>
10 #include <boost/qvm/vec.hpp>
11 //#include <boost/qvm/quat_traits.hpp>
12 #include "test_qvm_vector.hpp"
13 #include "test_qvm_matrix.hpp"
14 #include "gold.hpp"
15 
16 namespace
17     {
18     template <class T,class U> struct same_type_tester;
19     template <class T> struct same_type_tester<T,T> { };
test_same_type(T,U)20     template <class T,class U> void test_same_type( T, U ) { same_type_tester<T,U>(); }
21     }
22 
23 int
main()24 main()
25     {
26     using namespace boost::qvm;
27     test_qvm::vector<V1,3> x(42,1);
28     test_qvm::vector<V1,3> y=x*2;
29     test_qvm::matrix<M1,3,3> m;
30     A00(m) = 0;
31     A01(m) = -A2(x);
32     A02(m) = A1(x);
33     A10(m) = A2(x);
34     A11(m) = 0;
35     A12(m) = -A0(x);
36     A20(m) = -A1(x);
37     A21(m) = A0(x);
38     A22(m) = 0;
39         {
40         test_same_type(x,cross(x,y));
41         test_qvm::vector<V1,3> c=cross(x,y);
42         test_qvm::multiply_mv(c.b,m.a,y.a);
43         BOOST_QVM_TEST_EQ(c.a,c.b);
44         }
45         {
46         test_qvm::vector<V2,3> c=cross(vref(x),y);
47         test_qvm::multiply_mv(c.b,m.a,y.a);
48         BOOST_QVM_TEST_EQ(c.a,c.b);
49         }
50         {
51         test_qvm::vector<V2,3> c=cross(x,vref(y));
52         test_qvm::multiply_mv(c.b,m.a,y.a);
53         BOOST_QVM_TEST_EQ(c.a,c.b);
54         }
55     return boost::report_errors();
56     }
57