atan2 is not doing its job