Skip to main content
`Ctrl`+`K`

# scipy.spatial.transform.Rotation.approx_equal

Rotation.approx_equal(self, Rotation other, atol=None, degrees=False)

  Determine if another rotation is approximately equal to this one.

  Equality is measured by calculating the smallest angle between the rotations, and checking to see if it is smaller than atol.

  Parameters:
    other `Rotation` instance

      Object containing the rotations to measure against this one.

    atol float, optional

      The absolute angular tolerance, below which the rotations are considered equal. If not given, then set to 1e-8 radians by default.

    degrees bool, optional

      If True and atol is given, then atol is measured in degrees. If False (default), then atol is measured in radians.

  Returns:
    approx_equal ndarray or bool

      Whether the rotations are approximately equal, bool if object contains a single rotation and ndarray if object contains multiple rotations.

  Examples

      >>> from scipy.spatial.transform import Rotation as R
      >>> import numpy as np
      >>> p = R.from_quat([0, 0, 0, 1])
      >>> q = R.from_quat(np.eye(4))
      >>> p.approx_equal(q)
      array([False, False, False, True])

  Approximate equality for a single rotation:

      >>> p.approx_equal(q[0])
      False