roty_mat_test.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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=roty_mat<Dim>(r);
  18. test_qvm::rotation_y(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_roty(m2,r);
  22. test_qvm::rotation_y(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_y(m3,r);
  27. BOOST_QVM_TEST_EQ(m3.a,r1.a);
  28. }
  29. roty_mat<Dim>(0.0f)+roty_mat<Dim>(0.0f);
  30. -roty_mat<Dim>(0.0f);
  31. }
  32. }
  33. int
  34. main()
  35. {
  36. test<3>();
  37. test<4>();
  38. test<5>();
  39. return boost::report_errors();
  40. }