qops.limit_angle()#
- RotationalDiffusion.quaternions.limit_angle(quats)[source]#
Limit the rotation angle to the interval \([0, \pi]\).
Describing rotations with quaternions is ambiguous, because two quaternions \(q\) and \(-q\) describe the same rotation in clockwise and counter-clockwise direction, respectively. To remove this ambiguity, the rotation angle is limited by convention to the interval \([0, \pi]\). In other words, if the angle of an input quaternion \(q\) is beyond this interval, i.e., it is is in \((\pi, 2\pi)\), then \(-q\) is returned. Otherwise, if the angle is already in \([0, \pi]\), then \(q\) is returned without modification.