Generates a random direction in
.
Currently only implemented for 2D and 3D.
| Parameters: | ndim ((2|3),K) – |
|---|---|
| Return type: | array[K],unit_length |
Returns a set of random directions.
| Parameters: |
|
|---|---|
| Return type: | array[3xN] |
Returns a direction distant from both s and -s.
| Parameters: | s (direction) – |
|---|---|
| Return type: | direction |
Returns any axis orthogonal to s (not necessarily random).
| Parameters: | s (direction) – |
|---|---|
| Return type: | direction |
Returns a random axis orthogonal to s.
| Parameters: | s (array[K],unit_length) – |
|---|---|
| Return type: | array[K],unit_length |
.within a certain radius from the point center.
The points will be distributed uniformly in that area of the sphere. If center is not passed, it will be a random direction.
| Parameters: |
|
|---|---|
| Return type: | array[KxN],directions |
Returns the geodesic distance between two points on the sphere.
| Parameters: |
|
|---|---|
| Return type: | float,>=0,<=pi |
Returns the radius of the given directions distribution.
The radius is defined as the minimum r such that there exists a point s in S such that all distances are within r from s.
| Parameters: | S (directions) – |
|---|---|
| Return type: | float,>=0,<=pi |
Rearranges the directions in S in a better order for visualization.
In 2D, sorts the directions using their angle.
In 3D, it tries to do a pleasant elicoidal arrangement with num_around spires.
| Parameters: | S (array[KxN],(K=2|K=3),directions) – |
|---|---|
| Return type: | array[KxN],directions |
These are hyperspheres of unit radius.
Methods
| belongs | |
| belongs_ | |
| belongs_ts | |
| distance | |
| distance_ | |
| expmap | |
| expmap_ | |
| friendly | |
| geodesic | |
| interesting_points | |
| logmap | |
| logmap_ | |
| project_ts | |
| project_ts_ | |
| sample_uniform |
Unit circle as a subset of
.
Unit sphere.
Maps a vector to a 3x3 skew symmetric matrix.
| Parameters: | v (array[3]) – |
|---|---|
| Return type: | array[3x3],skew_symmetric |
The inverse of hat_map().
| Parameters: | H (array[3x3],skew_symmetric) – |
|---|---|
| Return type: | array[3] |
Converts a quaternion to a rotation matrix.
| Parameters: | x (unit_quaternion) – |
|---|---|
| Return type: | rotation_matrix |
| Parameters: |
|
|---|---|
| Return type: | rotation_matrix |
Get the rotation from the (axis,angle) representation.
This is an alternative to rotation_from_axis_angle() which goes through the quaternion representation.
| Parameters: |
|
|---|---|
| Return type: | rotation_matrix |
This is the inverse of quaternion_from_axis_angle().
| Parameters: | q (unit_quaternion) – |
|---|---|
| Return type: | axis_angle_canonical |
Returns the (axis,angle) representation of a given rotation.
There are a couple of symmetries:
- By convention, the angle returned is nonnegative.
- If the angle is 0, any axis will do. In that case, default_axis() will be returned.
| Parameters: | R (rotation_matrix) – |
|---|---|
| Return type: | axis_angle_canonical |
Converts a rotation matrix to a quaternion.
This is the robust method mentioned on wikipedia:
<http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation>
TODO: add the more robust method with 4x4 matrix and eigenvector
| Parameters: | R (rotation_matrix) – |
|---|---|
| Return type: | unit_quaternion |
| Parameters: |
|
|---|---|
| Return type: | array[MxM],M=N+1 |
| Parameters: | pose (array[NxN]) – |
|---|---|
| Return type: | tuple(array[MxM],array[M]),M=N-1 |
This is the Special Euclidean group SE(n) describing roto-translations of Euclidean space. Implemented only for n=2,3.
Note that you have to supply a coefficient alpha that weights rotation and translation when defining distances.
Methods
| belongs | |
| belongs_ | |
| belongs_ts | |
| distance | |
| distance_ | |
| expmap | |
| expmap_ | |
| friendly | |
| geodesic | |
| interesting_points | |
| inverse | |
| logmap | |
| logmap_ | |
| multiply | |
| project_ts | |
| project_ts_ | |
| sample_uniform | |
| unity |
This is the Lie algebra se(n) for the Special Euclidean group SE(n).
Note that you have to supply a coefficient alpha that weights rotation and translation when defining distances.
Methods
| belongs | |
| norm | |
| project |
Poses in 2D.
Poses in 3D.
Lie algebra for SE(2).
Lie algebra for SE(3).
Finds the best orthogonal transform R between X and Y, such that R X ~= Y.
| Parameters: |
|
|---|---|
| Return type: | array[KxK],orthogonal |
Finds the closest orthogonal matrix to M.
| Parameters: | M (array[NxN]) – |
|---|---|
| Return type: | array[NxN],orthogonal |
Returns the axis to use when any will do.
For example, the identity is represented by a rotation of 0 degrees around any axis. If an (axis,angle) representation is requested, the axis will be given by default_axis().
| Return type: | direction |
|---|
by default_axis().
Use this when you need a couple of arbitrary orthogonal axes.
| Return type: | direction |
|---|
Returns the arcosine of x, clipped between -1 and 1.
Use this when you know x is a cosine, but it might be slightly over 1 or below -1 due to numerical errors.
Normalizes the entries in x in the interval
.
Normalize an array such that it has unit length in the given norm.
| Parameters: | s (array) – |
|---|
| Parameters: | s (array) – |
|---|
Backporting assert_allclose from Numpy 1.5 to 1.4
These are some of the contracts defined using PyContracts.
Checks that two vectors are orthogonal.
| Parameters: |
|
|---|
This is the base class for differentiable manifolds.
Methods
| belongs | |
| belongs_ | |
| belongs_ts | |
| distance | |
| distance_ | |
| expmap | |
| expmap_ | |
| friendly | |
| geodesic | |
| interesting_points | |
| logmap | |
| logmap_ | |
| project_ts | |
| project_ts_ |
Checks that a point belongs to this manifold.
This function wraps some checks around belongs_(), which is implemented by the subclasses.
Checks that a point belongs to this manifold.
Checks that a vector vx belongs to the tangent space at the given point base.
Computes the geodesic distance between two points.
This function wraps some checks around distance_(), which is implemented by the subclasses.
Computes the geodesic distance between two points.
Computes the exponential map from base for the velocity vector v.
This function wraps some checks around expmap_(), which is implemented by the subclasses.
Computes the exponential map from a for the velocity vector v.
Returns a friendly description string for a point on the manifold.
Returns the point interpolated along the geodesic.
| Parameters: | t (>=0,<=1) – |
|---|
Returns a list of “interesting points” on this manifold that should be used for testing various properties.
Computes the logarithmic map from base point base to target b.
This function wraps some checks around logmap_(), which is implemented by the subclasses.
Computes the logarithmic map from base point a to target b.
Projects a vector v_ambient in the ambient space to the tangent space at point base.
This function wraps some checks around project_ts_(), which is implemented by the subclasses.
Projects a vector v_ambient in the ambient space to the tangent space at point base.
Methods
| inverse | |
| multiply | |
| unity |
Implements the group inversion.
Implements the group operation.
Returns the group unity.
This is the base class for Matrix Lie Algebra.
It is understood that it is composed by square matrices.
The only function that has to be implemented is the project() function that projects a square matrix onto the algebra. This function is used both for checking that a vector is in the algebra (see belongs()) and to mitigate the numerical errors.
You probably also want to implement norm() if the default is not what you want.
Methods
| belongs | |
| norm | |
| project |
Checks that a vector belongs to this algebra.
Return the norm of a vector in the algebra. This is used in MatrixLieGroup to measure distances between points in the Lie group.
Projects a matrix onto this Lie Algebra.
This is the base class for matrix Lie groups.
Subclasses should provide a MatrixLieAlgebra object. Given the Lie algebra, we can compute everything. However, subclasses can choose to overload some functions if they know a more numerically stable implementation.
Methods
| belongs | |
| belongs_ | |
| belongs_ts | |
| distance | |
| distance_ | |
| expmap | |
| expmap_ | |
| friendly | |
| geodesic | |
| interesting_points | |
| inverse | |
| logmap | |
| logmap_ | |
| multiply | |
| project_ts | |
| project_ts_ | |
| unity |
Computes the distance between two points.
In the case of Lie groups, this is done by translating everything to the origin, computing the logmap, and using the norm defined in the Lie Algebra object.
This is the inverse of logmap_().
In the case of Lie groups, this is implemented using the usual matrix exponential.
Here the MatrixLieAlgebra.project() function is used to mitigate numerical errors.
Returns the direction from base to target.
In the case of Lie groups, this is implemented by using the usual matrix logarithm at the origin.
Here the MatrixLieAlgebra.project() function is used to mitigate numerical errors.
Projects the vector x to the tangent space at point base.
In the case of Lie Groups, we do this by translating the vector to the origin, projecting it to the Lie Algebra, and then translating it back.
This is the usual Euclidean space of finite dimension; this is mostly used for debugging.
There is no proper Haar measure; as an arbitrary choice, the sample_uniform() returns a sample from a Gaussian distribution centered at 0.
Methods
| belongs | |
| belongs_ | |
| belongs_ts | |
| distance | |
| distance_ | |
| expmap | |
| expmap_ | |
| friendly | |
| geodesic | |
| interesting_points | |
| logmap | |
| logmap_ | |
| project_ts | |
| project_ts_ | |
| sample_uniform |
| Parameters: | x (array) – |
|---|
This is the Special Orthogonal group SO(n) describing rotations of Euclidean space; implemented for n=2,3.
Methods
| belongs | |
| belongs_ | |
| belongs_ts | |
| distance | |
| distance_ | |
| expmap | |
| expmap_ | |
| friendly | |
| geodesic | |
| interesting_points | |
| inverse | |
| logmap | |
| logmap_ | |
| multiply | |
| project_ts | |
| project_ts_ | |
| sample_uniform | |
| unity |
Methods
| belongs | |
| belongs_ | |
| belongs_ts | |
| distance | |
| distance_ | |
| expmap | |
| expmap_ | |
| friendly | |
| geodesic | |
| interesting_points | |
| logmap | |
| logmap_ | |
| normalize | |
| project_ts | |
| project_ts_ | |
| sample_uniform |
The Moebius strip – still to be implemented.
Methods
| belongs | |
| belongs_ | |
| belongs_ts | |
| distance | |
| distance_ | |
| expmap | |
| expmap_ | |
| friendly | |
| geodesic | |
| interesting_points | |
| logmap | |
| logmap_ | |
| normalize | |
| project_ts | |
| project_ts_ | |
| sample_uniform |