(otherwise you must use absolute values)

what I propose is the following method:

x1-x will give you the X distance between the points,

y1-y will give you the Y between the points.

now i build a right angle triangle

where one angle is 90 degrees.

and two lengths are known

to get the angles:

(x1-x)/(y1-y)=(a)/(90-a)

so just compute (x1-x)*(y1-y) into z

and you angle is either 90*z/z+1

or 90 minus that.

try to draw it out, and it'll be clearer.