从3个坐标中找到反射角度

时间:2014-07-23 09:36:18

标签: c math angle

我想从3点计算角度。目前我可以测量0-180之间的角度。但我需要从0-360获得角度。我如何测量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;
}

请注意(ax,ay)是中心但不是(0,0)和(bx,by),(cx,cy)可以是圆圈中的任何值。

任何人都可以帮我找到这个吗?

0 个答案:

没有答案
相关问题