common: remove EQUAL_EPSILON from mathlib.hh

This commit is contained in:
Eric Wasylishen 2017-04-26 14:25:55 -06:00
parent 03396787b2
commit ca58e90e15
5 changed files with 8 additions and 6 deletions

View File

@ -222,12 +222,13 @@ qmat3x3f RotateFromUpToSurfaceNormal(const qvec3f &surfaceNormal)
return rotations;
}
// FIXME: remove these
bool AABBsDisjoint(const vec3_t minsA, const vec3_t maxsA,
const vec3_t minsB, const vec3_t maxsB)
{
for (int i=0; i<3; i++) {
if (maxsA[i] < (minsB[i] - EQUAL_EPSILON)) return true;
if (minsA[i] > (maxsB[i] + EQUAL_EPSILON)) return true;
if (maxsA[i] < (minsB[i] - 0.001)) return true;
if (minsA[i] > (maxsB[i] + 0.001)) return true;
}
return false;
}

View File

@ -56,7 +56,6 @@ typedef struct {
extern const vec3_t vec3_origin;
#define EQUAL_EPSILON 0.001
#define ANGLEEPSILON 0.000001
#define ZERO_TRI_AREA_EPSILON 0.05f
#define POINT_EQUAL_EPSILON 0.05f
@ -64,10 +63,10 @@ extern const vec3_t vec3_origin;
qboolean VectorCompare(const vec3_t v1, const vec3_t v2, vec_t epsilon);
static inline bool
GLMVectorCompare(const qvec3f &v1, const qvec3f &v2)
GLMVectorCompare(const qvec3f &v1, const qvec3f &v2, float epsilon)
{
for (int i = 0; i < 3; i++)
if (fabs(v1[i] - v2[i]) > EQUAL_EPSILON)
if (fabs(v1[i] - v2[i]) > epsilon)
return false;
return true;
}

View File

@ -43,6 +43,7 @@
#define ON_EPSILON 0.1
#define ANGLE_EPSILON 0.001
#define EQUAL_EPSILON 0.001
typedef struct {
vec3_t color;

View File

@ -28,6 +28,7 @@
#define PORTALFILE2 "PRT2"
#define PORTALFILEAM "PRT1-AM"
#define ON_EPSILON 0.1
#define EQUAL_EPSILON 0.001
#define MAX_WINDING 64
#define MAX_WINDING_FIXED 24

View File

@ -416,7 +416,7 @@ CalcualateVertexNormals(const bsp2_t *bsp)
// sanity check
if (!neighboursToSmooth.size()) {
for (auto vertIndexNormalPair : smoothedNormals) {
Q_assert(GLMVectorCompare(vertIndexNormalPair.second, f_norm));
Q_assert(GLMVectorCompare(vertIndexNormalPair.second, f_norm, EQUAL_EPSILON));
}
}