Invert logic on CAABox::intersects

This commit is contained in:
Jack Andersen 2016-08-13 09:35:41 -10:00
parent c1d5449124
commit 7aa5ccf0c7
6 changed files with 15 additions and 15 deletions

View File

@ -92,12 +92,12 @@ public:
inline bool intersects(const CAABox& other) const inline bool intersects(const CAABox& other) const
{ {
bool x1 = (max[0] < other.min[0]); bool x1 = (max[0] > other.min[0]);
bool x2 = (min[0] > other.max[0]); bool x2 = (min[0] < other.max[0]);
bool y1 = (max[1] < other.min[1]); bool y1 = (max[1] > other.min[1]);
bool y2 = (min[1] > other.max[1]); bool y2 = (min[1] < other.max[1]);
bool z1 = (max[2] < other.min[2]); bool z1 = (max[2] > other.min[2]);
bool z2 = (min[2] > other.max[2]); bool z2 = (min[2] < other.max[2]);
return x1 && x2 && y1 && y2 && z1 && z2; return x1 && x2 && y1 && y2 && z1 && z2;
} }
bool intersects(const CSphere& other) const bool intersects(const CSphere& other) const

View File

@ -218,13 +218,13 @@ public:
inline void normalize() inline void normalize()
{ {
float mag = magnitude(); float mag = magnitude();
mag = 1.0 / mag; mag = 1.f / mag;
*this *= mag; *this *= mag;
} }
inline CColor normalized() const inline CColor normalized() const
{ {
float mag = magnitude(); float mag = magnitude();
mag = 1.0 / mag; mag = 1.f / mag;
return *this * mag; return *this * mag;
} }

View File

@ -45,7 +45,7 @@ public:
{ {
float nd = d; float nd = d;
float mag = vec.magnitude(); float mag = vec.magnitude();
mag = 1.0 / mag; mag = 1.f / mag;
vec *= mag; vec *= mag;
d = nd * mag; d = nd * mag;
} }

View File

@ -254,14 +254,14 @@ public:
inline void normalize() inline void normalize()
{ {
float mag = magnitude(); float mag = magnitude();
mag = 1.0 / mag; mag = 1.f / mag;
*this *= mag; *this *= mag;
} }
inline CVector2f normalized() const inline CVector2f normalized() const
{ {
float mag = magnitude(); float mag = magnitude();
mag = 1.0f / mag; mag = 1.f / mag;
return *this * mag; return *this * mag;
} }

View File

@ -256,13 +256,13 @@ public:
inline void normalize() inline void normalize()
{ {
float mag = magnitude(); float mag = magnitude();
mag = 1.0 / mag; mag = 1.f / mag;
*this *= mag; *this *= mag;
} }
inline CVector3f normalized() const inline CVector3f normalized() const
{ {
float mag = magnitude(); float mag = magnitude();
mag = 1.0 / mag; mag = 1.f / mag;
return *this * mag; return *this * mag;
} }
inline CVector3f cross(const CVector3f& rhs) const inline CVector3f cross(const CVector3f& rhs) const

View File

@ -298,13 +298,13 @@ public:
inline void normalize() inline void normalize()
{ {
float mag = magnitude(); float mag = magnitude();
mag = 1.0 / mag; mag = 1.f / mag;
*this *= mag; *this *= mag;
} }
inline CVector4f normalized() const inline CVector4f normalized() const
{ {
float mag = magnitude(); float mag = magnitude();
mag = 1.0 / mag; mag = 1.f / mag;
return *this * mag; return *this * mag;
} }