diff options
author | Mattes D <github@xoft.cz> | 2014-11-20 21:30:50 +0100 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-11-20 21:30:50 +0100 |
commit | f3e9fa74d25cd6d9494ee80677fef6ef552a06e3 (patch) | |
tree | 43f3aa838ddb4f204b7d3ec930f3527eddbbb0dc /src/Vector3.h | |
parent | Merge pull request #1603 from mc-server/ImprovedNoise (diff) | |
parent | Changed comment (diff) | |
download | cuberite-f3e9fa74d25cd6d9494ee80677fef6ef552a06e3.tar cuberite-f3e9fa74d25cd6d9494ee80677fef6ef552a06e3.tar.gz cuberite-f3e9fa74d25cd6d9494ee80677fef6ef552a06e3.tar.bz2 cuberite-f3e9fa74d25cd6d9494ee80677fef6ef552a06e3.tar.lz cuberite-f3e9fa74d25cd6d9494ee80677fef6ef552a06e3.tar.xz cuberite-f3e9fa74d25cd6d9494ee80677fef6ef552a06e3.tar.zst cuberite-f3e9fa74d25cd6d9494ee80677fef6ef552a06e3.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Vector3.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Vector3.h b/src/Vector3.h index 1854e42e3..1e4a1f5d9 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -93,6 +93,21 @@ public: return x * a_Rhs.x + y * a_Rhs.y + z * a_Rhs.z; } + inline void abs() + { + x = (x < 0) ? -x : x; + y = (y < 0) ? -y : y; + z = (z < 0) ? -z : z; + } + + // We can't use a capital letter, because we wouldn't be able to call the normal Clamp function. + inline void clamp(T a_Min, T a_Max) + { + x = Clamp(x, a_Min, a_Max); + y = Clamp(y, a_Min, a_Max); + z = Clamp(z, a_Min, a_Max); + } + inline Vector3<T> Cross(const Vector3<T> & a_Rhs) const { return Vector3<T>( |