Vi Veri Veniversum Vivus Vici
Best explanation ever: mathforum.org/library/drmath/view/61081.html

"I'll call the two points (x1,y1)
and (x2,y2).

x2 = x1 + cos(a * (pi / 180)) * u
y2 = y1 + sin(a * (pi / 180)) * u

Subtract the starting point coordinates:

x2 - x1 = cos(a * (pi / 180)) * u
y2 - y1 = sin(a * (pi / 180)) * u

Divide the second equation by the first:

(y2-y1)/(x2-x1) = (sin(a*pi/180)*u)/(cos(a*pi/180)*u)

What is sin/cos? It's the tangent.

(y2-y1)/(x2-x1) = tan(a*pi/180)

We can find the angle by taking the inverse tangent (arctan) of both
sides:

a*pi/180 = arctan((y2-y1)/(x2-x1))

a = 180/pi * arctan((y2-y1)/(x2-x1))"


@темы: Algorithms