I have a method and am attempting to find the angle between two points in radians.
public double angleTo(Body other)
{
double angle = Math.atan(Math.abs(this.y - other.y) / Math.abs(this.x - other.x));
while (angle < 0) {angle += Math.PI;}
while (angle > Math.PI) {angle -= Math.PI;}
return angle;
}
However when I call this method for points (0, 0) and (10, 10) I get 20.7758096196980899, which shouldn't be possible.