From e40564106cca106fb822181cc870c9ae353fbc14 Mon Sep 17 00:00:00 2001 From: DragonGeo2 <dragongeo2@users.sourceforge.net> Date: Thu, 27 May 2010 23:09:03 +0100 Subject: [PATCH] Make AsQuaternion a const member function (cherry-picked from aedra svn revision 1). --- include/nif_math.h | 2 +- src/nif_math.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/nif_math.h b/include/nif_math.h index 8ff3a6b6..2a55a940 100644 --- a/include/nif_math.h +++ b/include/nif_math.h @@ -621,7 +621,7 @@ struct Matrix33 { /*! Returns a quaternion representation of the rotation stored in this matrix. * \return A quaternion with an equivalent rotation to the one stored in this matrix. */ - NIFLIB_API Quaternion AsQuaternion(); + NIFLIB_API Quaternion AsQuaternion() const; /*! Calculates the determinant of this matrix. * \return The determinant of this matrix. diff --git a/src/nif_math.cpp b/src/nif_math.cpp index 48e8a1e7..a7ffb8d4 100644 --- a/src/nif_math.cpp +++ b/src/nif_math.cpp @@ -298,14 +298,14 @@ Matrix33::Matrix33() { *this = Matrix33::IDENTITY; } -Quaternion Matrix33::AsQuaternion() { +Quaternion Matrix33::AsQuaternion() const { Quaternion quat; float tr, s, q[4]; int i, j, k; int nxt[3] = {1, 2, 0}; - Matrix33 & m = *this; + const Matrix33 & m = *this; // compute the trace of the matrix tr = m[0][0] + m[1][1] + m[2][2]; -- GitLab