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.

Parameters:
quats(…, 4) ndarray

Quaternions.

Returns:
quats_limited(…, 4) ndarray

Quaternions with rotation angles limited to \([0, \pi]\).