sym.unit3 module

class Unit3(vec)[source]

Bases: object

Autogenerated Python implementation of symforce.geo.unit3.Unit3.

Direction in R^3 represented as a unit vector on the S^2 sphere manifold.

Storage is three dimensional, and tangent space is two dimensional. Due to the nature of the manifold, the unit X vector is handled as a singularity.

The implementation of the retract and local_coordinates functions are based on Appendix B.2 :

[Hertzberg 2013] Integrating Generic Sensor Fusion Algorithms with Sound State Representations through Encapsulation of Manifolds

The retract operation performs a perturbation to the desired unit X vector, which is then rotated to desired position along the actual stored unit vector through a Householder-reflection + relection across the XZ plane.

x.retract(delta) = x [+] delta = Rx * Exp(delta), where Exp(delta) = [cos(||delta||), sinc(||delta||) * delta], and Rx = (I - 2 vv^T / (v^Tv))X, v = x - e_x != 0, X is a matrix negating 2nd vector component

= diag(1, -1, -1) , x = e_x

See: unit3_visualization.ipynb for a visualization of the Unit3 manifold.

Parameters:

vec (T.Union[T.Sequence[float], numpy.ndarray]) –

data: List[float]
classmethod random(epsilon=1e-08)[source]

Return a random Unit3 object

Parameters:

epsilon (float) –

Return type:

Unit3

basis(epsilon)[source]

Returns a Matrix32 with the basis vectors of the tangent space (in R^3) at the current Unit3 direction.

Parameters:

epsilon (Unit3) –

Return type:

ndarray

to_unit_vector()[source]

Returns a Vector3 version of the unit direction.

Return type:

ndarray

static random_from_uniform_samples(u1, u2, epsilon)[source]

Generate a random Unit3 direction from two variables uniformly sampled in [0, 1].

Parameters:
Return type:

Unit3

static from_vector(a, epsilon)[source]

Return a Unit3 that points along the direction of vector a

a will be normalized.

Parameters:
Return type:

Unit3

static from_unit_vector(a)[source]

Return a Unit3 that points along the direction of vector a

a is expected to be a unit vector.

Parameters:

a (ndarray) –

Return type:

Unit3

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:

Unit3

static tangent_dim()[source]
Return type:

int

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

Unit3

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

ndarray

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

Unit3