This is a pre-release version (2.0.0.dev0+git20260907.41eeb59).Go to latest (1.18.0)
{ } Raw JSON

bundles / scipy 2.0.0.dev0+git20260907.41eeb59 / scipy / spatial / transform / _rotation / Rotation / approx_equal

function

scipy.spatial.transform._rotation:Rotation.approx_equal

source: build-install/usr/lib/python3.14/site-packages/scipy/spatial/transform/_rotation.py:1960

Signature

def approx_equal(self, other: Rotation, atol: float | None = None, degrees: bool = False) → Array | np.bool

Summary

Determine if another rotation is approximately equal to this one.

Extended Summary

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 : Array or `numpy.bool`

Whether the rotations are approximately equal, numpy.bool if object contains a single numpy rotation and Array if object contains multiple rotations or is from another library.

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])
✓
np.False_

Aliases

  • scipy.spatial.transform.Rotation.approx_equal