diff options
-rw-r--r-- | src/math/axis.cc | 9 | ||||
-rw-r--r-- | src/math/axis.h | 2 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/math/axis.cc b/src/math/axis.cc index 60d3797..a5ea397 100644 --- a/src/math/axis.cc +++ b/src/math/axis.cc @@ -104,11 +104,8 @@ void Axis::change_roll(const float angle) /* notes: http://mathworld.wolfram.com/RotationFormula.html */ -void Axis::rotate(Vector3f const &normal, float rad) +void Axis::rotate(Vector3f const &normal, float cosa, float sina) { - float cosa = cosf(rad); - float sina = sinf(rad); - for (size_t i = 0; i < 3; i++) { axis_vector[i] = axis_vector[i] * cosa + @@ -116,6 +113,10 @@ void Axis::rotate(Vector3f const &normal, float rad) crossproduct(axis_vector[i], normal) * sina; } } +void Axis::rotate(Vector3f const &normal, float rad) +{ + rotate(normal, cosf(rad), sinf(rad)); +} const Axis Axis::transpose() const { diff --git a/src/math/axis.h b/src/math/axis.h index 3991843..ef90654 100644 --- a/src/math/axis.h +++ b/src/math/axis.h @@ -86,6 +86,8 @@ public: * @brief rotation about an arbitrary vector * @param rad angle in radians **/ + void rotate(Vector3f const &normal, float cosa, float sina); + void rotate(const Vector3f & normal, const float rad); /// return the transpose of this matrix |