Fix computation of error when orientation is close to reference

  - theta/sin(theta) has been replaced by 1 when theta is less than 1e-6.