because atan() gives you only an angle between -90 and 90, (it considers the line as poining always to the right), while atan2 considers the line as pointing to the left if x2<x1.
So if x2-x1>0 ang=atan((y2-y1)/(x2-x1))
if x2-x1<0 ang=atan((y2-y1)/(x2-x1))+180
(i think...)
So if x2-x1>0 ang=atan((y2-y1)/(x2-x1))
if x2-x1<0 ang=atan((y2-y1)/(x2-x1))+180
(i think...)