diff options
Diffstat (limited to 'src/Vector3.h')
-rw-r--r-- | src/Vector3.h | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/src/Vector3.h b/src/Vector3.h index 762fdfd71..b5ddc705a 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -134,6 +134,22 @@ public: z += a_Diff.z; } + /** Runs each value of the vector through std::floor() */ + inline void Floor(void) + { + x = (T)floor(x); + y = (T)floor(y); + z = (T)floor(z); + } + + /** Clamps each value in the vector to within a specified range */ + inline void Clamp(T a_MinX, T a_MinY, T a_MinZ, T a_MaxX, T a_MaxY, T a_MaxZ) + { + x = Clamp(x, (T)copysign(a_MinX, x), (T)copysign(a_MaxX, x)); + y = Clamp(y, (T)copysign(a_MinY, y), (T)copysign(a_MaxY, y)); + z = Clamp(z, (T)copysign(a_MinZ, z), (T)copysign(a_MaxZ, z)); + } + // tolua_end inline bool operator != (const Vector3<T> & a_Rhs) const @@ -274,14 +290,6 @@ public: return (a_X - x) / (a_OtherEnd.x - x); } - /** Clamps each value in the vector to within a specified range */ - inline void Clamp(T a_MinX, T a_MinY, T a_MinZ, T a_MaxX, T a_MaxY, T a_MaxZ) - { - x = Clamp(x, (T)copysign(a_MinX, x), (T)copysign(a_MaxX, x)); - y = Clamp(y, (T)copysign(a_MinY, y), (T)copysign(a_MaxY, y)); - z = Clamp(z, (T)copysign(a_MinZ, z), (T)copysign(a_MaxZ, z)); - } - /** The max difference between two coords for which the coords are assumed equal. */ static const double EPS; |