rotz_mat_test.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //Copyright (c) 2008-2016 Emil Dotchevski and Reverge Studios, Inc.
  2. //Distributed under the Boost Software License, Version 1.0. (See accompanying
  3. //file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
  4. #include <boost/qvm/mat_operations.hpp>
  5. #include <boost/qvm/mat.hpp>
  6. #include "test_qvm_matrix.hpp"
  7. #include "gold.hpp"
  8. namespace
  9. {
  10. template <int Dim>
  11. void
  12. test()
  13. {
  14. using namespace boost::qvm;
  15. for( float r=0; r<6.28f; r+=0.5f )
  16. {
  17. test_qvm::matrix<M1,Dim,Dim> const m1=rotz_mat<Dim>(r);
  18. test_qvm::rotation_z(m1.b,r);
  19. BOOST_QVM_TEST_CLOSE(m1.a,m1.b,0.000001f);
  20. test_qvm::matrix<M1,Dim,Dim> m2(42,1);
  21. set_rotz(m2,r);
  22. test_qvm::rotation_z(m2.b,r);
  23. BOOST_QVM_TEST_CLOSE(m2.a,m2.b,0.000001f);
  24. test_qvm::matrix<M1,Dim,Dim> m3(42,1);
  25. test_qvm::matrix<M1,Dim,Dim> r1=m3*m1;
  26. rotate_z(m3,r);
  27. BOOST_QVM_TEST_EQ(m3.a,r1.a);
  28. }
  29. rotz_mat<Dim>(0.0f)+rotz_mat<Dim>(0.0f);
  30. -rotz_mat<Dim>(0.0f);
  31. }
  32. }
  33. int
  34. main()
  35. {
  36. test<2>();
  37. test<3>();
  38. test<4>();
  39. test<5>();
  40. return boost::report_errors();
  41. }