summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-12-03 12:29:26 -0800
committerIan Romanick <ian.d.romanick@intel.com>2009-12-03 12:29:26 -0800
commitda3fd3d210b73c665e8b1d3982b861539b6cd020 (patch)
treeff32ead93af2bfc03e0d7803ada858170e46939c
parent9cc09165071fc24c06947d2ee490f8e188ac5a52 (diff)
Add C++ wrappers for gluDeterminan4_4m and gluInverse4_4m
-rw-r--r--include/glu3.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/include/glu3.h b/include/glu3.h
index 3dff417..9f082ce 100644
--- a/include/glu3.h
+++ b/include/glu3.h
@@ -581,15 +581,22 @@ void gluTranspose4m(GLUmat4 *result, const GLUmat4 *m);
/**
* Calculate the determinant of a matrix.
+ *
+ * \sa gluDeterminant4 (C++)
*/
GLfloat gluDeterminant4_4m(const GLUmat4 *m);
/**
* Calculate the inverse of a matrix.
*
+ * Inverts the matrix \c m and stores the result in \c result. If \c m is
+ * not invertable, \c result is not modified
+ *
* \return
* If the matrix is invertable (i.e., the determinant is not zero), \c GL_TRUE
* is returned. Otherwise GL_FALSE is returned.
+ *
+ * \sa gluInverse4 (C++)
*/
GLboolean gluInverse4_4m(GLUmat4 *result, const GLUmat4 *m);
@@ -875,6 +882,55 @@ inline GLUmat4 gluLookAt(const GLUvec4 &eye, const GLUvec4 &center,
return result;
}
+/**
+ * Calculate the determinant of a matrix.
+ *
+ * \sa gluDeterminant4_4m
+ */
+inline GLfloat gluDeterminant4(const GLUmat4 &m)
+{
+ return gluDeterminant4_4m(& m);
+}
+
+/**
+ * Calculate the inverse of a matrix.
+ *
+ * Inverts the matrix \c m and stores the result in \c result. If \c m is
+ * not invertable, \c result is not modified
+ *
+ * \return
+ * If the matrix is invertable (i.e., the determinant is not zero), \c GL_TRUE
+ * is returned. Otherwise GL_FALSE is returned.
+ *
+ * \sa gluInverse4_4m
+ */
+inline GLboolean gluInverse4(GLUmat4 &result, const GLUmat4 &m)
+{
+ return gluInverse4_4m(& result, & m);
+}
+
+/**
+ * Calculate the inverse of a matrix.
+ *
+ * \return
+ * The inverse of the matrix \c m. If \c m is not invertable, the return
+ * result is undefined.
+ *
+ * \warning
+ * This function is really only safe when the input matrix is known to be
+ * invertable. Nearly all well behaved transformation matrices fall into this
+ * category.
+ *
+ * \sa gluInverse4_4m
+ */
+inline GLUmat4 gluInverse4(const GLUmat4 &m)
+{
+ GLUmat4 result;
+
+ gluInverse4_4m(& result, & m);
+ return result;
+}
+
#endif /* __cplusplus */
#include "glu3_scalar.h"