From 075b19c7cbf5d6e45dbd14e8fab5740d7000bf0f Mon Sep 17 00:00:00 2001 From: Mattes D Date: Wed, 24 Dec 2014 06:43:28 +0100 Subject: [PATCH] Added Vector3::TurnCW() and Vector3::TurnCCW() --- src/Vector3.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/Vector3.h b/src/Vector3.h index 1e4a1f5d9..1f3f6b955 100644 --- a/src/Vector3.h +++ b/src/Vector3.h @@ -307,6 +307,22 @@ public: return (a_X - x) / (a_OtherEnd.x - x); } + /** Rotates the vector 90 degrees clockwise around the vertical axis. + Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down. */ + inline void TurnCW(void) + { + std::swap(x, z); + x = -x; + } + + /** Rotates the vector 90 degrees counterclockwise around the vertical axis. + Note that this is specific to minecraft's axis ordering, which is X+ left, Z+ down. */ + inline void TurnCCW(void) + { + std::swap(x, z); + z = -z; + } + /** The max difference between two coords for which the coords are assumed equal. */ static const double EPS;