From 8195050fbcad1b5f4d93b355489366dad54c0e8b Mon Sep 17 00:00:00 2001 From: Oliver Sander <sander@igpm.rwth-aachen.de> Date: Wed, 16 Nov 2011 14:49:57 +0000 Subject: [PATCH] Move the constructor with a given axis and angle from the Quaternion class to the Rotation class. Rotation axes and angles are a genuine rotation concept and don't really belong into a quaternion implementation. [[Imported from SVN: r8207]] --- dune/gfe/quaternion.hh | 10 ---------- dune/gfe/rotation.hh | 10 ++++++++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/dune/gfe/quaternion.hh b/dune/gfe/quaternion.hh index df69b26b..a6580dfd 100644 --- a/dune/gfe/quaternion.hh +++ b/dune/gfe/quaternion.hh @@ -32,16 +32,6 @@ public: /** \brief Copy constructor */ Quaternion(const Dune::FieldVector<T,4>& other) : Dune::FieldVector<T,4>(other) {} - /** \brief Constructor with rotation axis and angle */ - Quaternion(Dune::FieldVector<T,3> axis, T angle) { - axis /= axis.two_norm(); - axis *= std::sin(angle/2); - (*this)[0] = axis[0]; - (*this)[1] = axis[1]; - (*this)[2] = axis[2]; - (*this)[3] = std::cos(angle/2); - } - /** \brief Assignment from a scalar */ Quaternion<T>& operator=(const T& v) { for (int i=0; i<4; i++) diff --git a/dune/gfe/rotation.hh b/dune/gfe/rotation.hh index 398f9d78..2ce7cfbd 100644 --- a/dune/gfe/rotation.hh +++ b/dune/gfe/rotation.hh @@ -192,8 +192,14 @@ public: } Rotation<T,3>(Dune::FieldVector<T,3> axis, T angle) - : Quaternion<T>(axis, angle) - {} + { + axis /= axis.two_norm(); + axis *= std::sin(angle/2); + (*this)[0] = axis[0]; + (*this)[1] = axis[1]; + (*this)[2] = axis[2]; + (*this)[3] = std::cos(angle/2); + } /** \brief Return the identity element */ static Rotation<T,3> identity() { -- GitLab