Added rotation angle calculation.