A
apropo
this function should return the degrees of the (AOB) angle. I tested it on a
value of 30° and it returned 36,869896, with the points declaration:
a.x=0;a.y=0;
b.x=3;b.y=4;
c.x=0;c.y=4;
and the call to the function:
alfa =winkelgroesse(b,a,c);
here is it:
float winkelgroesse(punkt m,punkt o,punkt n){ float a,b,c,alfa;
c=powf(m.x-n.x,2)+powf(m.y-n.y,2);
a=sqrtf(powf(o.x-n.x,2)+powf(o.y-n.y,2));
b=sqrtf(powf(o.x-m.x,2)+powf(o.y-m.y,2));
alfa=acosf((powf(a,2)+powf(b,2)-c)/(2*a*b));
alfa=180*alfa/PI;
return alfa; }
did i make a mistake at converting rad to degrees ?
value of 30° and it returned 36,869896, with the points declaration:
a.x=0;a.y=0;
b.x=3;b.y=4;
c.x=0;c.y=4;
and the call to the function:
alfa =winkelgroesse(b,a,c);
here is it:
float winkelgroesse(punkt m,punkt o,punkt n){ float a,b,c,alfa;
c=powf(m.x-n.x,2)+powf(m.y-n.y,2);
a=sqrtf(powf(o.x-n.x,2)+powf(o.y-n.y,2));
b=sqrtf(powf(o.x-m.x,2)+powf(o.y-m.y,2));
alfa=acosf((powf(a,2)+powf(b,2)-c)/(2*a*b));
alfa=180*alfa/PI;
return alfa; }
did i make a mistake at converting rad to degrees ?