Skip to content

Commit

Permalink
Added Vector3::TurnCW() and Vector3::TurnCCW()
Browse files Browse the repository at this point in the history
  • Loading branch information
madmaxoft committed Dec 24, 2014
1 parent 3dd94ba commit 075b19c
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/Vector3.h
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,22 @@ class Vector3
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;

Expand Down

0 comments on commit 075b19c

Please sign in to comment.