I have a triangle (A, B, C) and am trying to find the angle between each pair of the three points.
The problem is that the algorithms I can find online are for determining the angle between vectors. Using the vectors I would compute the angle between the vector that goes from (0, 0) to the point I have, and that doesn't give me the angles inside the triangle.
OK, here's some code in Python after the method on the Wikipedia page and after subtracting the values:
import numpy as np
points = np.array([[343.8998, 168.1526], [351.2377, 173.7503], [353.531, 182.72]])
A = points[2] - points[0]
B = points[1] - points[0]
C = points[2] - points[1]
for e1, e2 in ((A, B), (A, C), (B, C)):
num = np.dot(e1, e2)
denom = np.linalg.norm(e1) * np.linalg.norm(e2)
print np.arccos(num/denom) * 180
That gives me 60.2912487814, 60.0951900475 and 120.386438829, so what am I doing wrong?
(x,y)
coordinates? – Matt BallX
to another pointY
isY-X
– mokusB-A
&C-A
gives two vectors. And dot product between them gives the angles. – Mahesh