sym.rot3 module#

class Rot3(q=None)[source]#

Bases: object

Autogenerated Python implementation of symforce.geo.rot3.Rot3.

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 (T.Union[T.Sequence[float], numpy.ndarray, None]) –

data: List[float]#
classmethod from_rotation_matrix(R, epsilon=0.0)[source]#
Parameters:
Return type:

Rot3

classmethod random()[source]#
Return type:

Rot3

compose_with_point(right)[source]#

Left-multiplication. Either rotation concatenation or point transform.

Parameters:

right (Rot3) –

Return type:

ndarray

to_tangent_norm(epsilon)[source]#

Returns the norm of the tangent vector corresponding to this rotation

This is equal to the angle that should be rotated through to get this Rot3, in radians. Using this function directly is usually more efficient than computing the norm of the tangent vector, both in symbolic and generated code; by default, symbolic APIs will not automatically simplify to this

Parameters:

epsilon (Rot3) –

Return type:

float

to_rotation_matrix()[source]#

Converts to a rotation matrix

Return type:

ndarray

static random_from_uniform_samples(u1, u2, u3)[source]#

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

Parameters:
Return type:

Rot3

to_yaw_pitch_roll()[source]#

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

Euler angles are subject to gimbal lock: https://en.wikipedia.org/wiki/Gimbal_lock

This means that when the pitch is close to +/- pi/2, the yaw and roll angles are not uniquely defined, so the returned values are not unique in this case.

Returns:
  • Scalar – Yaw angle [radians]

  • Scalar – Pitch angle [radians]

  • Scalar – Roll angle [radians]

Return type:

ndarray

static from_yaw_pitch_roll(yaw, pitch, roll)[source]#

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

Parameters:
Return type:

Rot3

static from_angle_axis(angle, axis)[source]#

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

Parameters:
Return type:

Rot3

static from_two_unit_vectors(a, b, epsilon)[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

static storage_dim()[source]#
Return type:

int

to_storage()[source]#
Return type:

List[float]

classmethod from_storage(vec)[source]#
Parameters:

vec (Sequence[float]) –

Return type:

Rot3

classmethod identity()[source]#
Return type:

Rot3

inverse()[source]#
Return type:

Rot3

compose(b)[source]#
Parameters:

b (Rot3) –

Return type:

Rot3

between(b)[source]#
Parameters:

b (Rot3) –

Return type:

Rot3

static tangent_dim()[source]#
Return type:

int

classmethod from_tangent(vec, epsilon=1e-08)[source]#
Parameters:
Return type:

Rot3

to_tangent(epsilon=1e-08)[source]#
Parameters:

epsilon (float) –

Return type:

ndarray

retract(vec, epsilon=1e-08)[source]#
Parameters:
Return type:

Rot3

local_coordinates(b, epsilon=1e-08)[source]#
Parameters:
Return type:

ndarray

interpolate(b, alpha, epsilon=1e-08)[source]#
Parameters:
Return type:

Rot3