if y > 0 then if x > 0 then tc1 = arctan(y/x) if x < 0 then tc1 = 180 - arctan(-y/x) if x = 0 then tc1 = 90 if y < 0 then if x > 0 then tc1 = -arctan(-y/x) if x < 0 then tc1 = arctan(y/x)-180 if x = 0 then tc1 = 270 if y = 0 then if x > 0 then tc1 = 0 if x < 0 then tc1 = 180 if x = 0 then [the 2 points are the same] #### print atan2( $_->[0], $_->[1] ) for [ 0,-1],[ 0,+1],[-1, 0],[+1, 0], [+1,+1],[-1,+1],[-1,-1],[+1,-1];; 3.14159265358979 0 -1.5707963267949 1.5707963267949 0.785398163397448 -0.785398163397448 -2.35619449019234 2.35619449019234