diff options
author | Ian Romanick <idr@freedesktop.org> | 2010-07-17 23:55:38 -0700 |
---|---|---|
committer | Ian Romanick <idr@freedesktop.org> | 2010-07-17 23:55:38 -0700 |
commit | 640b86e028431a566b1c21e9be3f52e2bf18e87c (patch) | |
tree | 8cc424d939b09eff60c2fb781ee026f6d90790c0 | |
parent | 8d7d3b98f52285ccfaafc7b36e9ac11ad1715a1c (diff) |
Measure all angles in radians
This differs from fixed-function GL (and classic GLU), but it matches
GLSL and the standard C library. It turns out that gluRotate4v and
gluRotate were already assuming the angle was in radians, in spite of
what the documentation said.
-rw-r--r-- | include/glu3.h | 6 | ||||
-rw-r--r-- | src/matrix.c | 6 |
2 files changed, 5 insertions, 7 deletions
diff --git a/include/glu3.h b/include/glu3.h index ea59c51..98688d3 100644 --- a/include/glu3.h +++ b/include/glu3.h @@ -661,7 +661,7 @@ void gluTranslate4v(GLUmat4 *result, const GLUvec4 *v); * Calculate a rotation matrix around an arbitrary axis * * \param axis Axis, based at the origin, around which to rotate - * \param angle Angle of rotation in degrees + * \param angle Angle of rotation in radians * * If the specificed axis is not unit length, the vector will be normalized. * @@ -752,7 +752,7 @@ void gluFrustum6f(GLUmat4 *result, GLfloat left, GLfloat right, GLfloat bottom, * Calculate a perspective projection matrix * * \param result Storage for the resulting matrix. - * \param fovy Field-of-view in the Y direction + * \param fovy Field-of-view in the Y direction, measured in radians * \param aspect The ratio of the size in the X direction to the size in the * Y direction. This is used to calculate the field-of-view in * the X direction. @@ -1099,7 +1099,7 @@ inline GLUmat4 gluTranslate(const GLUvec4 &v) * Calculate a rotation matrix around an arbitrary axis * * \param axis Axis, based at the origin, around which to rotate - * \param angle Angle of rotation in degrees + * \param angle Angle of rotation in radians * * If the specificed axis is not unit length, the vector will be normalized. * diff --git a/src/matrix.c b/src/matrix.c index 569ff2d..8ae9c37 100644 --- a/src/matrix.c +++ b/src/matrix.c @@ -33,8 +33,6 @@ #define M_PI 3.14159265358979323846 #endif -#define DEG2RAD(d) ((d) * M_PI / 180.0) - const GLUmat4 gluIdentityMatrix = { { { { 1.0f, 0.0f, 0.0f, 0.0f } }, @@ -193,8 +191,8 @@ void gluPerspective4f(GLUmat4 *result, GLfloat fovy, GLfloat aspect, GLfloat n, GLfloat f) { - const double sine = sin(DEG2RAD(fovy / 2.0)); - const double cosine = cos(DEG2RAD(fovy / 2.0)); + const double sine = sin(fovy / 2.0); + const double cosine = cos(fovy / 2.0); const double sine_aspect = sine * aspect; const double dz = f - n; |