Just click the flag and it will put the line and dot in random places. Then press the space bar and the line will point towards the dot and give you the angle too.
I figured out this math to help a close friend of mine, Airtoum, make a 3D engine. Make sure you check him out.