Skip to content

Instantly share code, notes, and snippets.

@NikolausDemmel
Last active December 30, 2015 23:39
Show Gist options
  • Save NikolausDemmel/7901983 to your computer and use it in GitHub Desktop.
Save NikolausDemmel/7901983 to your computer and use it in GitHub Desktop.
--- OpenNI2-2.2.0.30/ThirdParty/GL/glh/glh_linear.h.orig 2013-10-09 15:29:17.000000000 -0700
+++ OpenNI2-2.2.0.30/ThirdParty/GL/glh/glh_linear.h 2013-10-09 15:29:38.000000000 -0700
@@ -77,7 +77,7 @@
#define GLH_EPSILON GLH_REAL(10e-6)
#define GLH_PI GLH_REAL(3.1415926535897932384626433832795)
-#define equivalent(a,b) (((a < b + GLH_EPSILON) && (a > b - GLH_EPSILON)) ? true : false)
+#define glh_equiv(a,b) (((a < b + GLH_EPSILON) && (a > b - GLH_EPSILON)) ? true : false)
namespace glh
{
@@ -1093,7 +1093,7 @@
real norm = q[0] * q[0] + q[1] * q[1] + q[2] * q[2] + q[3] * q[3];
- s = (equivalent(norm,GLH_ZERO)) ? GLH_ZERO : ( GLH_TWO / norm );
+ s = (glh_equiv(norm,GLH_ZERO)) ? GLH_ZERO : ( GLH_TWO / norm );
xs = q[0] * s;
ys = q[1] * s;
@@ -1194,7 +1194,7 @@
theta *= real(0.5);
real sin_theta = real(sin(theta));
- if (!equivalent(sqnorm,GLH_ONE))
+ if (!glh_equiv(sqnorm,GLH_ONE))
sin_theta /= real(sqrt(sqnorm));
x = sin_theta * axis.v[0];
y = sin_theta * axis.v[1];
@@ -1216,14 +1216,14 @@
alpha = p1.dot(p2);
- if(equivalent(alpha,GLH_ONE))
+ if(glh_equiv(alpha,GLH_ONE))
{
*this = identity();
return *this;
}
// ensures that the anti-parallel case leads to a positive dot
- if(equivalent(alpha,-GLH_ONE))
+ if(glh_equiv(alpha,-GLH_ONE))
{
vec3 v;
@@ -1280,7 +1280,7 @@
void normalize()
{
real rnorm = GLH_ONE / real(sqrt(w * w + x * x + y * y + z * z));
- if (equivalent(rnorm, GLH_ZERO))
+ if (glh_equiv(rnorm, GLH_ZERO))
return;
x *= rnorm;
y *= rnorm;
@@ -1439,10 +1439,10 @@
inline
bool operator == ( const quaternion & q1, const quaternion & q2 )
{
- return (equivalent(q1.x, q2.x) &&
- equivalent(q1.y, q2.y) &&
- equivalent(q1.z, q2.z) &&
- equivalent(q1.w, q2.w) );
+ return (glh_equiv(q1.x, q2.x) &&
+ glh_equiv(q1.y, q2.y) &&
+ glh_equiv(q1.z, q2.z) &&
+ glh_equiv(q1.w, q2.w) );
}
inline
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment