summaryrefslogtreecommitdiffstats
path: root/src/Vector3.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-30 20:21:21 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-06-30 20:21:21 +0200
commit85fae0e521d3a2ea4f083ee2bc54ac7fbb357768 (patch)
tree0ca17a95845e4a836ac231360b554a8854a41083 /src/Vector3.h
parentSuggestions (diff)
downloadcuberite-85fae0e521d3a2ea4f083ee2bc54ac7fbb357768.tar
cuberite-85fae0e521d3a2ea4f083ee2bc54ac7fbb357768.tar.gz
cuberite-85fae0e521d3a2ea4f083ee2bc54ac7fbb357768.tar.bz2
cuberite-85fae0e521d3a2ea4f083ee2bc54ac7fbb357768.tar.lz
cuberite-85fae0e521d3a2ea4f083ee2bc54ac7fbb357768.tar.xz
cuberite-85fae0e521d3a2ea4f083ee2bc54ac7fbb357768.tar.zst
cuberite-85fae0e521d3a2ea4f083ee2bc54ac7fbb357768.zip
Diffstat (limited to '')
-rw-r--r--src/Vector3.h24
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;