restrict theta to [-180,180]