symforce.geo.rot2 module

class Rot2(z=None)[source]

Bases: LieGroup

Group of two-dimensional orthogonal matrices with determinant +1, representing rotations in 2D space. Backed by a complex number.

Parameters:

z (T.Optional[Complex]) –

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:

Rot2

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:

Rot2

classmethod identity()[source]

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

Return type:

Rot2

compose(other)[source]

Apply the group operation with other.

Parameters:

other (Rot2) –

Return type:

Rot2

inverse()[source]

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

Return type:

Rot2

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:
Return type:

Rot2

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:

Matrix22

storage_D_tangent()[source]

Note: generated from symforce/notebooks/storage_D_tangent.ipynb

Return type:

Matrix21

tangent_D_storage()[source]

Note: generated from symforce/notebooks/tangent_D_storage.ipynb

Return type:

Matrix12

__mul__(right)[source]

Left-multiplication. Either rotation concatenation or point transform.

Parameters:

right (Rot2 | Matrix21) –

Return type:

Rot2 | Matrix21

classmethod from_angle(theta)[source]

Create a Rot2 from an angle theta in radians

This is equivalent to from_tangent([theta])

Parameters:

theta (float) –

Return type:

Rot2

to_angle(epsilon=0.0)[source]

Get the angle of this Rot2 in radians

This is equivalent to to_tangent()[0]

Parameters:

epsilon (float) –

Return type:

float

to_rotation_matrix()[source]

A matrix representation of this element in the Euclidean space that contains it.

Return type:

Matrix22

classmethod from_rotation_matrix(r)[source]

Create a Rot2 from a 2x2 rotation matrix.

Returns the closest Rot2 to the input matrix, by the Frobenius norm. Will be singular when r[0, 0] == -r[1, 1] and r[0, 1] == r[1, 0] are both true.

See notebooks/rot2_from_rotation_matrix_derivation.ipynb for the derivation.

Parameters:

r (Matrix22) –

Return type:

Rot2

classmethod random()[source]

Generate a random element of SO3.

Return type:

Rot2

classmethod random_from_uniform_sample(u1, pi=pi)[source]

Generate a random element of SO2 from a variable uniformly sampled on [0, 1].

Parameters:
Return type:

Rot2