You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tools.hxx 712B

12345678910111213141516171819202122232425262728
  1. #ifndef TOOLS_HXX
  2. #define TOOLS_HXX
  3. #include <math.h>
  4. #define uge_gm_tmpl_mn template<unsigned M, unsigned N>
  5. uge_gm_tmpl_mn MatrixMxN<M, N> Tools::normalizeAngle(const MatrixMxN<M, N> &rotation)
  6. {
  7. MatrixMxN<M, N> other;
  8. for (int i = 0; i < M; ++i) {
  9. for (int j = 0; j < N; ++j) {
  10. other.setScalar(i, j, normalizeAngle(rotation.getScalar(i)));
  11. }
  12. }
  13. return other;
  14. }
  15. uge_gm_tmpl_mn MatrixMxN<M, N> Tools::radToDegree(const MatrixMxN<M, N> &rotation)
  16. {
  17. return rotation * MatrixMxN<M, N>(180.0 / M_PI);
  18. }
  19. uge_gm_tmpl_mn MatrixMxN<M, N> Tools::degreeToRad(const MatrixMxN<M, N> &rotation)
  20. {
  21. return rotation * MatrixMxN<M, N>(M_PI / 180.0);
  22. }
  23. #endif // TOOLS_HXX