diff --git a/include/nif_math.h b/include/nif_math.h index 8ff3a6b6df9a7ecd0329313ec691eb6e0cb24899..2a55a94092265dbb2580ab4d84340830470f60c2 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 48e8a1e771d407f42988c3aea0e430f6332bb627..a7ffb8d4bb9e1699d872c70a36a8f382da157aaf 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];