summaryrefslogtreecommitdiffstats
path: root/src/Vector3.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/Vector3.h32
1 files changed, 31 insertions, 1 deletions
diff --git a/src/Vector3.h b/src/Vector3.h
index 5faac1457..1dcb38f64 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -3,7 +3,7 @@
-#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
+#define _USE_MATH_DEFINES // Enable non-standard math defines (MSVC)
#include <math.h>
#include <list>
#include <vector>
@@ -134,6 +134,16 @@ public:
z += a_Diff.z;
}
+ /** Runs each value of the vector through std::floor() */
+ inline Vector3<int> Floor(void) const
+ {
+ return Vector3<int>(
+ (int)floor(x),
+ (int)floor(y),
+ (int)floor(z)
+ );
+ }
+
// tolua_end
inline bool operator != (const Vector3<T> & a_Rhs) const
@@ -146,6 +156,16 @@ public:
return Equals(a_Rhs);
}
+ inline bool operator > (const Vector3<T> & a_Rhs) const
+ {
+ return (SqrLength() > a_Rhs.SqrLength());
+ }
+
+ inline bool operator < (const Vector3<T> & a_Rhs) const
+ {
+ return (SqrLength() < a_Rhs.SqrLength());
+ }
+
inline void operator += (const Vector3<T> & a_Rhs)
{
x += a_Rhs.x;
@@ -288,6 +308,7 @@ protected:
{
return (a_Value < 0) ? -a_Value : a_Value;
}
+
};
// tolua_end
@@ -295,6 +316,15 @@ protected:
+template <> inline Vector3<int> Vector3<int>::Floor(void) const
+{
+ return *this;
+}
+
+
+
+
+
template <typename T>
const double Vector3<T>::EPS = 0.000001;