How to calculate an angle from three points?

If you mean the angle that P1 is the vertex of then using the Law of Cosines should work:

arccos((P122 + P132 – P232) / (2 * P12 * P13))

where P12 is the length of the segment from P1 to P2, calculated by

sqrt((P1x – P2x)2 + (P1y – P2y)2)

Leave a Comment