Skip to contents

Class for the special orthogonal group \(\mathrm{SO}(3)\) in vector form, i.e. the Lie group of 3D rotations. This class is specific to the vector representation of rotations. For the matrix representation, use the SpecialOrthogonal class and set n = 3.

See also

Author

Nicolas Guigui and Nina Miolane

Super classes

rgeomstats::PythonClass -> rgeomstats::Manifold -> rgeomstats::LieGroup -> rgeomstats::SpecialOrthogonalVectors -> SpecialOrthogonal3Vectors

Public fields

bi_invariant_metric

An object of class BiInvariantMetric specifying the metric to equip the manifold with.

Methods

Inherited methods


Method new()

The SpecialOrthogonal3Vectors class constructor.

Usage

SpecialOrthogonal3Vectors$new(epsilon = 0, py_cls = NULL)

Arguments

epsilon

A numeric value specifying the precision to use for calculations involving potential division by 0 in rotations. Defaults to 0.

py_cls

A Python object of class SpecialOrthogonal3Vectors. Defaults to NULL in which case it is instantiated on the fly using the other input arguments.

Returns

An object of class SpecialOrthogonal3Vectors.


Method rotation_vector_from_matrix()

Converts a 3D rotation from matrix to axis-angle representation.

Usage

SpecialOrthogonal3Vectors$rotation_vector_from_matrix(rot_mat)

Arguments

rot_mat

A numeric array of shape \([\dots \times 3 \times 3]\) specifying one or more 3D rotation matrices.

Details

Gets the angle \(\theta\) through the trace of the rotation matrix. The eigenvalues are: $$\{ 1, \cos \theta + i \sin \theta, \cos \theta - i \sin \theta \}$$ so that $$\mathrm{trace} = 1 + 2 \cos \theta, \{ -1 \leq \mathrm{trace} \leq 3 \}.$$

The rotation vector is the vector associated to the skew-symmetric matrix $$S_r = \frac{\theta}{(2 \sin \theta) (R - R^T)}.$$

For the edge case where the angle is close to \(\pi\), the rotation vector (up to sign) is derived by using the following equality (see the axis-angle representation on Wikipedia): $$\mathrm{outer}(r, r) = \frac{1}{2} (R + I_3).$$

In nD, the rotation vector stores the \(n(n-1)/2\) values of the skew-symmetric matrix representing the rotation.

Returns

A numeric array of shape \([\dots \times 3]\) storing the corresponding axis-angle representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$rotation_vector_from_matrix(diag(1, 3))
}


Method matrix_from_rotation_vector()

Converts a 3D rotation from axis-angle to matrix representation.

Usage

SpecialOrthogonal3Vectors$matrix_from_rotation_vector(rot_vec)

Arguments

rot_vec

A numeric array of shape \([\dots \times 3]\) specifying one or more 3D rotations in axis-angle representation.

Returns

A numeric array of shape \([\dots \times 3 \times 3]\) storing the corresponding matrix representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$matrix_from_rotation_vector(rep(0, 3))
}


Method quaternion_from_matrix()

Converts a 3D rotation from matrix to unit quaternion representation.

Usage

SpecialOrthogonal3Vectors$quaternion_from_matrix(rot_mat)

Arguments

rot_mat

A numeric array of shape \([\dots \times 3 \times 3]\) specifying one or more 3D rotations in matrix representation.

Returns

A numeric array of shape \([\dots \times 4]\) storing the corresponding unit quaternion representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$quaternion_from_matrix(diag(1, 3))
}


Method quaternion_from_rotation_vector()

Converts a 3D rotation from axis-angle to unit quaternion representation.

Usage

SpecialOrthogonal3Vectors$quaternion_from_rotation_vector(rot_vec)

Arguments

rot_vec

A numeric array of shape \([\dots \times 3]\) specifying one or more 3D rotations in axis-angle representation.

Returns

A numeric array of shape \([\dots \times 4]\) storing the corresponding unit quaternion representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$quaternion_from_rotation_vector(rep(0, 3))
}


Method rotation_vector_from_quaternion()

Converts a 3D rotation from unit quaternion to axis-angle representation.

Usage

SpecialOrthogonal3Vectors$rotation_vector_from_quaternion(quaternion)

Arguments

quaternion

A numeric array of shape \([\dots \times 4]\) specifying one or more 3D rotations in unit quaternion representation.

Returns

A numeric array of shape \([\dots \times 3]\) storing the corresponding axis-angle representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$rotation_vector_from_quaternion(array(c(1, rep(0, 3))))
}


Method matrix_from_quaternion()

Converts a 3D rotation from unit quaternion to matrix representation.

Usage

SpecialOrthogonal3Vectors$matrix_from_quaternion(quaternion)

Arguments

quaternion

A numeric array of shape \([\dots \times 4]\) specifying one or more 3D rotations in unit quaternion representation.

Returns

A numeric array of shape \([\dots \times 3 \times 3]\) storing the corresponding matrix representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$matrix_from_quaternion(c(1, rep(0, 3)))
}


Method matrix_from_tait_bryan_angles()

Converts a 3D rotation from Tait-Bryan angle to matrix representation.

Usage

SpecialOrthogonal3Vectors$matrix_from_tait_bryan_angles(
  tait_bryan_angles,
  extrinsic_or_intrinsic = "extrinsic",
  order = "zyx"
)

Arguments

tait_bryan_angles

A numeric array of shape \([\dots \times 3]\) specifying one or more 3D rotations in Tait-Bryan angle representation.

extrinsic_or_intrinsic

A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either "extrinsic" (fixed frame) or "intrinsic" (moving frame). Defaults to "extrinsic".

order

A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either "xyz" or "zyx". Defaults to "zyx".

Details

Converts a rotation given in terms of the Tait-Bryan angles [angle_1, angle_2, angle_3] in extrinsic (fixed) or intrinsic (moving) coordinate frame in the corresponding matrix representation. If the order is zyx, into the rotation matrix rot_mat = X(angle_1) Y(angle_2) Z(angle_3) where:

  • X(angle_1) is a rotation of angle angle_1 around axis x;

  • Y(angle_2) is a rotation of angle angle_2 around axis y;

  • Z(angle_3) is a rotation of angle angle_3 around axis z.

Exchanging 'extrinsic' and 'intrinsic' amounts to exchanging the order.

Returns

A numeric array of shape \([\dots \times 3 \times 3]\) storing the corresponding matrix representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$matrix_from_tait_bryan_angles(rep(0, 3))
}


Method tait_bryan_angles_from_matrix()

Converts a 3D rotation from matrix to Tait-Bryan angle representation.

Usage

SpecialOrthogonal3Vectors$tait_bryan_angles_from_matrix(
  rot_mat,
  extrinsic_or_intrinsic = "extrinsic",
  order = "zyx"
)

Arguments

rot_mat

A numeric array of shape \([\dots \times 3 \times 3]\) specifying one or more 3D rotations in matrix representation.

extrinsic_or_intrinsic

A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either "extrinsic" (fixed frame) or "intrinsic" (moving frame). Defaults to "extrinsic".

order

A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either "xyz" or "zyx". Defaults to "zyx".

Details

Converts a rotation given in matrix representation into its Tait-Bryan angle representation [angle_1, angle_2, angle_3] in extrinsic (fixed) or intrinsic (moving) coordinate frame in the corresponding matrix representation. If the order is zyx, into the rotation matrix rot_mat = X(angle_1) Y(angle_2) Z(angle_3) where:

  • X(angle_1) is a rotation of angle angle_1 around axis x;

  • Y(angle_2) is a rotation of angle angle_2 around axis y;

  • Z(angle_3) is a rotation of angle angle_3 around axis z.

Exchanging 'extrinsic' and 'intrinsic' amounts to exchanging the order.

Returns

A numeric array of shape \([\dots \times 3]\) storing the corresponding Tait-Bryan angle representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$tait_bryan_angles_from_matrix(diag(1, 3))
}


Method quaternion_from_tait_bryan_angles()

Converts a 3D rotation from Tait-Bryan angle to unit quaternion representation.

Usage

SpecialOrthogonal3Vectors$quaternion_from_tait_bryan_angles(
  tait_bryan_angles,
  extrinsic_or_intrinsic = "extrinsic",
  order = "zyx"
)

Arguments

tait_bryan_angles

A numeric array of shape \([\dots \times 3]\) specifying one or more 3D rotations in Tait-Bryan angle representation.

extrinsic_or_intrinsic

A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either "extrinsic" (fixed frame) or "intrinsic" (moving frame). Defaults to "extrinsic".

order

A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either "xyz" or "zyx". Defaults to "zyx".

Returns

A numeric array of shape \([\dots \times 4]\) storing the corresponding unit quaternion representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$quaternion_from_tait_bryan_angles(rep(0, 3))
}


Method rotation_vector_from_tait_bryan_angles()

Converts a 3D rotation from Tait-Bryan angle to axis-angle representation.

Usage

SpecialOrthogonal3Vectors$rotation_vector_from_tait_bryan_angles(
  tait_bryan_angles,
  extrinsic_or_intrinsic = "extrinsic",
  order = "zyx"
)

Arguments

tait_bryan_angles

A numeric array of shape \([\dots \times 3]\) specifying one or more 3D rotations in Tait-Bryan angle representation.

extrinsic_or_intrinsic

A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either "extrinsic" (fixed frame) or "intrinsic" (moving frame). Defaults to "extrinsic".

order

A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either "xyz" or "zyx". Defaults to "zyx".

Returns

A numeric array of shape \([\dots \times 3]\) storing the corresponding axis-angle representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$rotation_vector_from_tait_bryan_angles(rep(0, 3))
}


Method tait_bryan_angles_from_quaternion()

Converts a 3D rotation from matrix to Tait-Bryan angle representation.

Usage

SpecialOrthogonal3Vectors$tait_bryan_angles_from_quaternion(
  quaternion,
  extrinsic_or_intrinsic = "extrinsic",
  order = "zyx"
)

Arguments

quaternion

A numeric array of shape \([\dots \times 4]\) specifying one or more 3D rotations in unit quaternion representation.

extrinsic_or_intrinsic

A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either "extrinsic" (fixed frame) or "intrinsic" (moving frame). Defaults to "extrinsic".

order

A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either "xyz" or "zyx". Defaults to "zyx".

Returns

A numeric array of shape \([\dots \times 3]\) storing the corresponding Tait-Bryan angle representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$tait_bryan_angles_from_quaternion(c(1, rep(0, 3)))
}


Method tait_bryan_angles_from_rotation_vector()

Converts a 3D rotation from axis-angle to Tait-Bryan angle representation.

Usage

SpecialOrthogonal3Vectors$tait_bryan_angles_from_rotation_vector(
  rot_vec,
  extrinsic_or_intrinsic = "extrinsic",
  order = "zyx"
)

Arguments

rot_vec

A numeric array of shape \([\dots \times 3]\) specifying one or more 3D rotations in axis-angle representation.

extrinsic_or_intrinsic

A character string specifying the coordinate frame in which the Tait-Bryan angles are expressed. Choices are either "extrinsic" (fixed frame) or "intrinsic" (moving frame). Defaults to "extrinsic".

order

A character string specifying the order of the rotation composition around the three axes of the chosen coordinate frame. Choices are either "xyz" or "zyx". Defaults to "zyx".

Returns

A numeric array of shape \([\dots \times 3]\) storing the corresponding Tait-Bryan angle representations.

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$tait_bryan_angles_from_rotation_vector(rep(0, 3))
}


Method random_uniform()

Samples in \(\mathrm{SO}(3)\) from a uniform distribution.

Usage

SpecialOrthogonal3Vectors$random_uniform(n_samples = 1)

Arguments

n_samples

An integer value specifying the sample size. Defaults to 1L.

Returns

A numeric array of shape \([\dots \times 3]\) storing a sample of 3D rotations in axis-angle representation uniformly sampled in \(\mathrm{SO}(3)\).

Examples

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$random_uniform()
}


Method clone()

The objects of this class are cloneable with this method.

Usage

SpecialOrthogonal3Vectors$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$rotation_vector_from_matrix`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$rotation_vector_from_matrix(diag(1, 3))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$matrix_from_rotation_vector`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$matrix_from_rotation_vector(rep(0, 3))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$quaternion_from_matrix`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$quaternion_from_matrix(diag(1, 3))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$quaternion_from_rotation_vector`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$quaternion_from_rotation_vector(rep(0, 3))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$rotation_vector_from_quaternion`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$rotation_vector_from_quaternion(array(c(1, rep(0, 3))))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$matrix_from_quaternion`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$matrix_from_quaternion(c(1, rep(0, 3)))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$matrix_from_tait_bryan_angles`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$matrix_from_tait_bryan_angles(rep(0, 3))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$tait_bryan_angles_from_matrix`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$tait_bryan_angles_from_matrix(diag(1, 3))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$quaternion_from_tait_bryan_angles`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$quaternion_from_tait_bryan_angles(rep(0, 3))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$rotation_vector_from_tait_bryan_angles`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$rotation_vector_from_tait_bryan_angles(rep(0, 3))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$tait_bryan_angles_from_quaternion`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$tait_bryan_angles_from_quaternion(c(1, rep(0, 3)))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$tait_bryan_angles_from_rotation_vector`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$tait_bryan_angles_from_rotation_vector(rep(0, 3))
}

## ------------------------------------------------
## Method `SpecialOrthogonal3Vectors$random_uniform`
## ------------------------------------------------

if (reticulate::py_module_available("geomstats")) {
  so3 <- SpecialOrthogonal(n = 3, point_type = "vector")
  so3$random_uniform()
}