summaryrefslogtreecommitdiffstats
path: root/src/Vector3.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-01 23:39:37 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-01 23:39:37 +0200
commit284c1c0514168e30338f2ad372b7e7f185dba0c4 (patch)
tree66e9ef12dda74a3c5e48b0ce8aa96427e903ff40 /src/Vector3.h
parentImplemented Vector3<>::Floor() (diff)
downloadcuberite-284c1c0514168e30338f2ad372b7e7f185dba0c4.tar
cuberite-284c1c0514168e30338f2ad372b7e7f185dba0c4.tar.gz
cuberite-284c1c0514168e30338f2ad372b7e7f185dba0c4.tar.bz2
cuberite-284c1c0514168e30338f2ad372b7e7f185dba0c4.tar.lz
cuberite-284c1c0514168e30338f2ad372b7e7f185dba0c4.tar.xz
cuberite-284c1c0514168e30338f2ad372b7e7f185dba0c4.tar.zst
cuberite-284c1c0514168e30338f2ad372b7e7f185dba0c4.zip
Diffstat (limited to '')
-rw-r--r--src/Vector3.h33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/Vector3.h b/src/Vector3.h
index b5ddc705a..faf7fe43c 100644
--- a/src/Vector3.h
+++ b/src/Vector3.h
@@ -135,19 +135,13 @@ public:
}
/** Runs each value of the vector through std::floor() */
- inline void Floor(void)
+ inline Vector3<T> Floor(void) const
{
- 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));
+ return Vector3<T>(
+ (T)floor(x),
+ (T)floor(y),
+ (T)floor(z)
+ );
}
// tolua_end
@@ -162,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;
@@ -305,11 +309,6 @@ protected:
return (a_Value < 0) ? -a_Value : a_Value;
}
- /** Clamp X to the specified range. */
- T Clamp(T a_Value, T a_Min, T a_Max)
- {
- return (a_Value < a_Min) ? a_Min : ((a_Value > a_Max) ? a_Max : a_Value);
- }
};
// tolua_end