fixed cartesianToPolar calculation so that negative values work properly. updated to allow 1d simulations