And here, for anyone needing the facing based upon a start and end position, is C# code. It really wasn't that hard...
Code:
/// <summary>
/// Returns a (possibly "corrected") facing from a start and end point
/// </summary>
/// <param name="start">The starting point</param>
/// <param name="end">The ending point</param>
/// <param name="useWoWFacing">Whether to correct for the WoW axis rotation.</param>
/// <returns>The facing (possibly "corrected" for WoW) resulting from the movement.</returns>
/// <remarks>Note that WoW uses a rotated axis. Also, on most display systems, the
/// Y axis is inverted, with upwards movement decreasing Y and downwards movement
/// increasing it. This should be accounted for if rendering to screen.</remarks>
float GetFacing(PointF start, PointF end, bool useWoWFacing)
{
float dX = end.X - start.X;
float dY = end.Y - start.Y;
// North in WoW means decreasing Y, so the Y axis needs to be flipped
if (useWoWFacing)
{
dY = -dY;
}
// note: C# floats correctly handle neg/pos Infinity; there is no need
// to account for dX being zero!
float angle = (float)Math.Atan(dY / dX);
// WoW rotates the axes such that facing 0 is due north (which would be PI/2
// in a nonrotated coord system; if the flag is set, we return the WoW facing
// rather than the "correct" facing.
if (useWoWFacing)
{
angle -= (float)Math.PI / 2.0f; // wow axis rotation
}
// probably could use an "if" instead of "while" for these, but
// the "while" formulation allows for angles less than -2PI and
// greater than 4PI and doesn't cost much computationally.
while (angle < 0)
{
angle += 2.0f * (float)Math.PI;
}
while (angle > 2.0f * (float)Math.PI)
{
angle -= 2.0f * (float)Math.PI;
}
return angle;
}