How to calculate an angle from three points?

Posted by HelloMoon on Stack Overflow See other posts from Stack Overflow or by HelloMoon
Published on 2009-07-31T07:55:04Z Indexed on 2010/05/24 1:10 UTC
Read the original article Hit count: 791

Filed under:

Lets say you have this:

P1 = (x=2, y=50) P2 = (x=9, y=40) P3 = (x=5, y=20)

Assume that P1 is the center point of a circle. It is always the same. I want the angle that is made up by P2 and P3, or in other words the angle that is next to P1. The inner angle to be precise. It will be always a sharp angle, so less than -90 degrees.

I thought: Man, that's simplest geometry maths. But I looked for a formula for like 6 hours now and people talk about most complicated NASA stuff like arcos and vector scalar product stuff. My head feels like in a fridge.

Some math gurus here that think this is a simple problem? I think the programing language doesn't matter here but for those who think it does: java and objective-c. need that for both. haven't tagged it for these, though.

© Stack Overflow or respective owner

Related posts about math