I need to find angle between two line in my c# program. Can someone help me to calculate the points if only start end poinst given.
for line L1 starting point(X1,Y1) and End point (X2,Y2) Given same as for L2 also
I need to find angle between two line in my c# program. Can someone help me to calculate the points if only start end poinst given.
for line L1 starting point(X1,Y1) and End point (X2,Y2) Given same as for L2 also
First, you need to get the two vectors v1
and v2
the two lines and normalize them to the length of 1
. Then,
angle = acos(v1•v2)
where: • = 'dot' product and acos
= inverse of cosine.
But be aware, there are always two possible results: a1
and a2
where a1+a2 = 180°