float CRadarCodeView::GetAngle(float x, float y)//
float ret;
float xoffset=x;
float yoffset=y;
if (xoffset==0)
{
if (yoffset>=0)
ret=0;
else
ret=180;
}
else if(yoffset==0)
{
if (xoffset>=0)
ret=90;
else
ret=270;
}
else
{
float angletmp = float(atan(xoffset/yoffset)*180/3.141593);
if(xoffset>0 && yoffset<0)
ret = angletmp+180;
else if(xoffset<0 && yoffset>0)
ret = angletmp + 360;
else if(xoffset<0 && yoffset<0)
ret = 180+angletmp;
else
ret = angletmp;
}
return ret;
}
DIEA