1 2 3 4 5 6 7 8 9 10 11

float getAngle (float x1,float y1,float z1,float x2,float y2,float z2)
{
float theta = atan2(z1z2,x1x2);
return theta*180/3.1415926;
}
float getAngle2 (float x1,float y1,float z1,float x2,float y2,float z2)
{
float dist=sqrt(pow(x1  x2,2) + pow(y1  y2,2) + pow(z1  z2,2));
float dist2=sqrt(pow(x1  x2,2) + pow(z1  z2,2));
return acos(dist2/dist)*180/3.1415926;
}
 