0

I want to calculate angle from 3 points. Currently I can measure angles between 0-180. But I need to get angles from 0-360. How can i measure angles between 180-360?

int find_angle_from_cordinates_test(int ax,int ay,int bx,int by,int cx,int cy)
{
    float sa = sqrt((cx-bx) * (cx-bx) + (cy - by)*(cy-by));
    float sb = sqrt((cx-ax) * (cx-ax) + (cy - ay)*(cy-ay));
    float sc = sqrt((ax-bx) * (ax-bx) + (ay - by)*(ay-by));

    float aa = acosf((sb * sb + sc * sc - sa*sa)/(2 * sb * sc));

    printf("Angle a : %f\n\r",(aa*180)/PI);         

    return (aa*180)/PI;
}

please note that (ax, ay) is center but not (0,0) and (bx,by), (cx,cy) can be any value in the circle.

Can anyone help me to find this?

Shihab
  • 501
  • 1
  • 11
  • 25
  • Solve it with [this](http://en.wikipedia.org/wiki/Triangle#Sine.2C_cosine_and_tangent_rules). Take all the length of the lines between points, then compute for the angle which vertex is (bx, by). – n3rd4n1 Jul 23 '14 at 09:56
  • This could help: http://stackoverflow.com/questions/14066933/direct-way-of-computing-clockwise-angle-between-2-vectors – Jan Spurny Jul 23 '14 at 10:33
  • 1
    To my understanding, the problem is ill-defined; how would you know whether you would like to use the smaller or the larger angle? – Codor Jul 23 '14 at 11:32

0 Answers0