I needed this for a 3D engine I'm working on, so I could have a sprite point towards a pair of coordinates that were off screen. (Sprites can't go off screen so I had to remake the "point towards' block.
The original is made by Airtoum, so be sure to check him out. It is essentially the same, I just tweaked it to make it more efficient. Be sure to check his version out though. I did the math for this. To see my original math, look on my page and find a project called Pointing Math.