Abstract Class for the 3D Special Orthogonal Group in Vector Representation
Source:R/special-orthogonal.R
SpecialOrthogonal3Vectors.Rd
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
Other special orthogonal classes:
SpecialOrthogonal2Vectors
,
SpecialOrthogonalMatrices
,
SpecialOrthogonal()
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
Public methods
Inherited methods
rgeomstats::PythonClass$get_python_class()
rgeomstats::PythonClass$set_python_class()
rgeomstats::Manifold$belongs()
rgeomstats::Manifold$is_tangent()
rgeomstats::Manifold$random_point()
rgeomstats::Manifold$random_tangent_vec()
rgeomstats::Manifold$regularize()
rgeomstats::Manifold$set_metric()
rgeomstats::Manifold$to_tangent()
rgeomstats::LieGroup$add_metric()
rgeomstats::LieGroup$compose()
rgeomstats::LieGroup$exp()
rgeomstats::LieGroup$exp_from_identity()
rgeomstats::LieGroup$exp_not_from_identity()
rgeomstats::LieGroup$get_identity()
rgeomstats::LieGroup$inverse()
rgeomstats::LieGroup$jacobian_translation()
rgeomstats::LieGroup$lie_bracket()
rgeomstats::LieGroup$log()
rgeomstats::LieGroup$log_from_identity()
rgeomstats::LieGroup$log_not_from_identity()
rgeomstats::LieGroup$tangent_translation_map()
rgeomstats::SpecialOrthogonalVectors$projection()
rgeomstats::SpecialOrthogonalVectors$regularize_tangent_vec()
rgeomstats::SpecialOrthogonalVectors$regularize_tangent_vec_at_identity()
rgeomstats::SpecialOrthogonalVectors$skew_matrix_from_vector()
rgeomstats::SpecialOrthogonalVectors$vector_from_skew_matrix()
Method new()
The SpecialOrthogonal3Vectors
class constructor.
Usage
SpecialOrthogonal3Vectors$new(epsilon = 0, py_cls = NULL)
Method rotation_vector_from_matrix()
Converts a 3D rotation from matrix to axis-angle representation.
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.
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.
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.
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.
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.
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 angleangle_1
around axisx
;Y(angle_2)
is a rotation of angleangle_2
around axisy
;Z(angle_3)
is a rotation of angleangle_3
around axisz
.
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 angleangle_1
around axisx
;Y(angle_2)
is a rotation of angleangle_2
around axisy
;Z(angle_3)
is a rotation of angleangle_3
around axisz
.
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.
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()
}
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()
}