]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/qvm/test/cross_test.cpp
1 //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
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)
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"
18 template <class T
,class U
> struct same_type_tester
;
19 template <class T
> struct same_type_tester
<T
,T
> { };
20 template <class T
,class U
> void test_same_type( T
, U
) { same_type_tester
<T
,U
>(); }
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
;
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
);
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
);
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
);
55 return boost::report_errors();