symforce.geo.rot3 module

class Rot3(q=None)[source]

Bases: LieGroup

Group of three-dimensional orthogonal matrices with determinant +1, representing rotations in 3D space. Backed by a quaternion with (x, y, z, w) storage.

Parameters:

q (Optional[Quaternion]) –

__init__(q=None)[source]

Construct from a unit quaternion, or identity if none provided.

Parameters:

q (Optional[Quaternion]) –

classmethod storage_dim()[source]

Dimension of underlying storage

Return type:

int

to_storage()[source]

Flat list representation of the underlying storage, length of STORAGE_DIM. This is used purely for plumbing, it is NOT like a tangent space.

Return type:

List[float]

classmethod from_storage(vec)[source]

Construct from a flat list representation. Opposite of .to_storage().

Parameters:

vec (Sequence[float]) –

Return type:

Rot3

classmethod symbolic(name, **kwargs)[source]

Construct a symbolic element with the given name prefix. Kwargs are forwarded to sf.Symbol (for example, sympy assumptions).

Parameters:
  • name (str) –

  • kwargs (Any) –

Return type:

Rot3

classmethod identity()[source]

Identity element such that compose(a, identity) = a.

Return type:

Rot3

compose(other)[source]

Apply the group operation with other.

Parameters:

other (Rot3) –

Return type:

Rot3

inverse()[source]

Group inverse, such that compose(a, inverse(a)) = identity.

Return type:

Rot3

classmethod tangent_dim()[source]

Dimension of the embedded manifold

Return type:

int

classmethod from_tangent(v, epsilon=0.0)[source]

Mapping from the tangent space vector about identity into a group element.

Parameters:
  • v (Sequence[float]) –

  • epsilon (float) –

Return type:

Rot3

logmap_acos_clamp_max(epsilon=0.0)[source]

Implementation of logmap that uses epsilon with the Min function to avoid the singularity in the sqrt at w == 1

Also flips the sign of the quaternion of w is negative, which makes sure that the resulting tangent vector has norm <= pi

Parameters:

epsilon (float) –

Return type:

List[float]

to_tangent(epsilon=0.0)[source]

Mapping from this element to the tangent space vector about identity.

Parameters:

epsilon (float) –

Return type:

List[float]

classmethod hat(vec)[source]
Parameters:

vec (Sequence[float]) –

Return type:

Matrix33

storage_D_tangent()[source]

Note: generated from symforce/notebooks/storage_D_tangent.ipynb

Return type:

Matrix43

tangent_D_storage()[source]

Note: generated from symforce/notebooks/tangent_D_storage.ipynb

Return type:

Matrix34

__mul__(right)[source]

Left-multiplication. Either rotation concatenation or point transform.

Parameters:

right (Union[Matrix31, Rot3]) –

Return type:

Union[Matrix31, Rot3]

to_rotation_matrix()[source]

Converts to a rotation matrix

Return type:

Matrix33

classmethod from_rotation_matrix(R, epsilon=0.0)[source]

Construct from a rotation matrix.

Parameters:
Return type:

Rot3

to_yaw_pitch_roll(epsilon=0.0)[source]

Compute the yaw, pitch, and roll Euler angles in radians of this rotation

Returns:

Yaw angle [radians] Scalar: Pitch angle [radians] Scalar: Roll angle [radians]

Return type:

Scalar

Parameters:

epsilon (float) –

classmethod from_yaw_pitch_roll(yaw=0, pitch=0, roll=0)[source]

Construct from yaw, pitch, and roll Euler angles in radians

Parameters:
  • yaw (float) –

  • pitch (float) –

  • roll (float) –

Return type:

Rot3

classmethod from_angle_axis(angle, axis)[source]

Construct from an angle in radians and a (normalized) axis as a 3-vector.

Parameters:
Return type:

Rot3

classmethod from_two_unit_vectors(a, b, epsilon=0.0)[source]

Return a rotation that transforms a to b. Both inputs are three-vectors that are expected to be normalized.

Reference:

http://lolengine.net/blog/2013/09/18/beautiful-maths-quaternion-from-vectors

Parameters:
Return type:

Rot3

angle_between(other, epsilon=0.0)[source]

Return the angle between this rotation and the other in radians.

Parameters:
  • other (Rot3) –

  • epsilon (float) –

Return type:

float

classmethod random()[source]

Generate a random element of SO3.

Return type:

Rot3

classmethod random_from_uniform_samples(u1, u2, u3, pi=pi)[source]

Generate a random element of SO3 from three variables uniformly sampled in [0, 1].

Parameters:
  • u1 (float) –

  • u2 (float) –

  • u3 (float) –

  • pi (float) –

Return type:

Rot3