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/quat_operations.hpp>
10# include <boost/qvm/mat_operations.hpp>
11# include <boost/qvm/quat.hpp>
12#endif
13
14#include "test_qvm_quaternion.hpp"
15#include "test_qvm_matrix.hpp"
16#include "gold.hpp"
17
18namespace
19 {
20 void
21 test()
22 {
23 using namespace boost::qvm;
24 for( float r=0; r<6.28f; r+=0.5f )
25 {
26 test_qvm::quaternion<Q1> q1=rotz_quat(angle: r);
27 test_qvm::matrix<M1,3,3> m1=convert_to< test_qvm::matrix<M1,3,3> >(q: q1);
28 test_qvm::rotation_z(r&: m1.b,angle: r);
29 BOOST_QVM_TEST_CLOSE(m1.a,m1.b,0.000001f);
30 test_qvm::quaternion<Q2> q2(42,1);
31 set_rotz(a&: q2,angle: r);
32 test_qvm::matrix<M1,3,3> m2=convert_to< test_qvm::matrix<M1,3,3> >(q: q2);
33 test_qvm::rotation_z(r&: m2.b,angle: r);
34 BOOST_QVM_TEST_CLOSE(m2.a,m2.b,0.000001f);
35 test_qvm::quaternion<Q1> q3(42,1);
36 test_qvm::quaternion<Q1> r1=q3*q1;
37 rotate_z(a&: q3,angle: r);
38 BOOST_QVM_TEST_CLOSE(q3.a,r1.a,0.000001f);
39 }
40 rotz_quat(angle: 0.0f)+rotz_quat(angle: 0.0f);
41 -rotz_quat(angle: 0.0f);
42 }
43 }
44
45int
46main()
47 {
48 test();
49 return boost::report_errors();
50 }
51

source code of boost/libs/qvm/test/rotz_quat_test.cpp