pub struct Rn { /* private fields */ }Expand description
Rⁿ group element representing n-dimensional Euclidean vectors.
Internally represented using nalgebra’s DVector
Implementations§
Source§impl Rn
impl Rn
Sourcepub const DIM: usize = 0
pub const DIM: usize = 0
Space dimension - dimension of the ambient space that the group acts on Note: For Rⁿ this is dynamic and determined at runtime
Sourcepub const DOF: usize = 0
pub const DOF: usize = 0
Degrees of freedom - dimension of the tangent space Note: For Rⁿ this is dynamic and determined at runtime
Sourcepub const REP_SIZE: usize = 0
pub const REP_SIZE: usize = 0
Representation size - size of the underlying data representation Note: For Rⁿ this is dynamic and determined at runtime
Sourcepub fn identity() -> Rn
pub fn identity() -> Rn
Get the identity element of the group.
Returns the neutral element e such that e ∘ g = g ∘ e = g for any group element g. Note: Default to 3D identity for compatibility, but this should be created with specific dimension
Sourcepub fn jacobian_identity() -> Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>
pub fn jacobian_identity() -> Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>
Get the identity matrix for Jacobians.
Returns the identity matrix in the appropriate dimension for Jacobian computations. Note: Default to 3x3 identity, but this should be created with specific dimension
Sourcepub fn from_slice(slice: &[f64]) -> Rn
pub fn from_slice(slice: &[f64]) -> Rn
Sourcepub fn from_vec(components: Vec<f64>) -> Rn
pub fn from_vec(components: Vec<f64>) -> Rn
Create Rⁿ from individual components (up to 6D for convenience).
Sourcepub fn data(
&self,
) -> &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>
pub fn data( &self, ) -> &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>
Get the underlying vector.
Sourcepub fn set_component(&mut self, index: usize, value: f64)
pub fn set_component(&mut self, index: usize, value: f64)
Set a specific component.
Sourcepub fn norm_squared(&self) -> f64
pub fn norm_squared(&self) -> f64
Get the squared norm of the vector.
Source§impl Rn
impl Rn
Sourcepub fn identity_with_dim(dim: usize) -> Rn
pub fn identity_with_dim(dim: usize) -> Rn
Create identity element with specific dimension.
For Euclidean space, the identity (additive neutral element) is the zero vector.
The default identity() returns a 3D zero vector for compatibility.
Use this method when you need a specific dimension.
Sourcepub fn random_with_dim(dim: usize) -> Rn
pub fn random_with_dim(dim: usize) -> Rn
Create Rn with specific dimension and random values.
Trait Implementations§
Source§impl Interpolatable for Rn
impl Interpolatable for Rn
Source§impl LieGroup for Rn
impl LieGroup for Rn
Source§fn compose(
&self,
other: &Rn,
jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
jacobian_other: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
) -> Rn
fn compose( &self, other: &Rn, jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>, jacobian_other: Option<&mut <Rn as LieGroup>::JacobianMatrix>, ) -> Rn
Rⁿ composition (vector addition).
§Arguments
other- Another Rⁿ element.jacobian_self- Optional Jacobian matrix of the composition wrt self.jacobian_other- Optional Jacobian matrix of the composition wrt other.
§Notes
For Euclidean space: v₁ + v₂ Jacobians: d(v₁ + v₂)/dv₁ = I, d(v₁ + v₂)/dv₂ = I
Source§fn log(
&self,
jacobian: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
) -> <Rn as LieGroup>::TangentVector
fn log( &self, jacobian: Option<&mut <Rn as LieGroup>::JacobianMatrix>, ) -> <Rn as LieGroup>::TangentVector
Source§fn vee(&self) -> <Rn as LieGroup>::TangentVector
fn vee(&self) -> <Rn as LieGroup>::TangentVector
Vee operator: log(g)^∨.
For Euclidean space, this is the same as log().
Source§fn act(
&self,
vector: &Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>,
jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
jacobian_vector: Option<&mut Matrix<f64, Const<3>, Const<3>, ArrayStorage<f64, 3, 3>>>,
) -> Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>
fn act( &self, vector: &Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>, jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>, jacobian_vector: Option<&mut Matrix<f64, Const<3>, Const<3>, ArrayStorage<f64, 3, 3>>>, ) -> Matrix<f64, Const<3>, Const<1>, ArrayStorage<f64, 3, 1>>
Action on a 3-vector (for compatibility with the trait).
§Arguments
vector- A 3-vector.jacobian_self- Optional Jacobian of the new object wrt this.jacobian_vector- Optional Jacobian of the new object wrt input object.
§Returns
The transformed 3-vector.
§Notes
For Euclidean space, the action is translation: v + x This only works if this Rⁿ element is 3-dimensional.
Source§fn is_approx(&self, other: &Rn, tolerance: f64) -> bool
fn is_approx(&self, other: &Rn, tolerance: f64) -> bool
Check if the element is approximately equal to another element.
§Arguments
other- The other element to compare withtolerance- The tolerance for the comparison
Source§fn right_plus(
&self,
tangent: &<Rn as LieGroup>::TangentVector,
jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
jacobian_tangent: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
) -> Rn
fn right_plus( &self, tangent: &<Rn as LieGroup>::TangentVector, jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>, jacobian_tangent: Option<&mut <Rn as LieGroup>::JacobianMatrix>, ) -> Rn
Right plus operation: v ⊞ δ = v + δ.
For Euclidean space, this is simple vector addition.
§Arguments
tangent- Tangent vector perturbationjacobian_self- Optional Jacobian ∂(v ⊞ δ)/∂v = Ijacobian_tangent- Optional Jacobian ∂(v ⊞ δ)/∂δ = I
§Notes
For Euclidean space: v ⊞ δ = v + δ Jacobians: ∂(v + δ)/∂v = I, ∂(v + δ)/∂δ = I
Source§fn right_minus(
&self,
other: &Rn,
jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
jacobian_other: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
) -> <Rn as LieGroup>::TangentVector
fn right_minus( &self, other: &Rn, jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>, jacobian_other: Option<&mut <Rn as LieGroup>::JacobianMatrix>, ) -> <Rn as LieGroup>::TangentVector
Right minus operation: v₁ ⊟ v₂ = v₁ - v₂.
For Euclidean space, this is simple vector subtraction.
§Arguments
other- The reference element v₂jacobian_self- Optional Jacobian ∂(v₁ ⊟ v₂)/∂v₁ = Ijacobian_other- Optional Jacobian ∂(v₁ ⊟ v₂)/∂v₂ = -I
§Notes
For Euclidean space: v₁ ⊟ v₂ = v₁ - v₂ Jacobians: ∂(v₁ - v₂)/∂v₁ = I, ∂(v₁ - v₂)/∂v₂ = -I
Source§fn left_plus(
&self,
tangent: &<Rn as LieGroup>::TangentVector,
jacobian_tangent: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
) -> Rn
fn left_plus( &self, tangent: &<Rn as LieGroup>::TangentVector, jacobian_tangent: Option<&mut <Rn as LieGroup>::JacobianMatrix>, jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>, ) -> Rn
Left plus operation: δ ⊞ v = δ + v.
For Euclidean space (abelian group), left plus is the same as right plus.
§Arguments
tangent- Tangent vector perturbationjacobian_tangent- Optional Jacobian ∂(δ ⊞ v)/∂δ = Ijacobian_self- Optional Jacobian ∂(δ ⊞ v)/∂v = I
§Notes
For abelian groups: δ ⊞ v = v ⊞ δ = δ + v
Source§fn left_minus(
&self,
other: &Rn,
jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
jacobian_other: Option<&mut <Rn as LieGroup>::JacobianMatrix>,
) -> <Rn as LieGroup>::TangentVector
fn left_minus( &self, other: &Rn, jacobian_self: Option<&mut <Rn as LieGroup>::JacobianMatrix>, jacobian_other: Option<&mut <Rn as LieGroup>::JacobianMatrix>, ) -> <Rn as LieGroup>::TangentVector
Left minus operation: v₁ ⊟ v₂ = v₁ - v₂.
For Euclidean space (abelian group), left minus is the same as right minus.
§Arguments
other- The reference element v₂jacobian_self- Optional Jacobian ∂(v₁ ⊟ v₂)/∂v₁ = Ijacobian_other- Optional Jacobian ∂(v₁ ⊟ v₂)/∂v₂ = -I
§Notes
For abelian groups: left minus = right minus
Source§fn tangent_dim(&self) -> usize
fn tangent_dim(&self) -> usize
Source§type TangentVector = RnTangent
type TangentVector = RnTangent
Source§type JacobianMatrix = Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>
type JacobianMatrix = Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>
Source§type LieAlgebra = Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>
type LieAlgebra = Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>
Source§fn jacobian_identity() -> <Rn as LieGroup>::JacobianMatrix
fn jacobian_identity() -> <Rn as LieGroup>::JacobianMatrix
Source§fn zero_jacobian() -> <Rn as LieGroup>::JacobianMatrix
fn zero_jacobian() -> <Rn as LieGroup>::JacobianMatrix
Source§fn is_valid(&self, _tolerance: f64) -> bool
fn is_valid(&self, _tolerance: f64) -> bool
Source§fn plus(
&self,
tangent: &Self::TangentVector,
jacobian_self: Option<&mut Self::JacobianMatrix>,
jacobian_tangent: Option<&mut Self::JacobianMatrix>,
) -> Self
fn plus( &self, tangent: &Self::TangentVector, jacobian_self: Option<&mut Self::JacobianMatrix>, jacobian_tangent: Option<&mut Self::JacobianMatrix>, ) -> Self
Source§fn minus(
&self,
other: &Self,
jacobian_self: Option<&mut Self::JacobianMatrix>,
jacobian_other: Option<&mut Self::JacobianMatrix>,
) -> Self::TangentVector
fn minus( &self, other: &Self, jacobian_self: Option<&mut Self::JacobianMatrix>, jacobian_other: Option<&mut Self::JacobianMatrix>, ) -> Self::TangentVector
Source§fn between(
&self,
other: &Self,
jacobian_self: Option<&mut Self::JacobianMatrix>,
jacobian_other: Option<&mut Self::JacobianMatrix>,
) -> Self
fn between( &self, other: &Self, jacobian_self: Option<&mut Self::JacobianMatrix>, jacobian_other: Option<&mut Self::JacobianMatrix>, ) -> Self
Source§impl Tangent<Rn> for RnTangent
impl Tangent<Rn> for RnTangent
Source§const DIM: usize = 0
const DIM: usize = 0
Dimension of the tangent space Note: For Rⁿ this is dynamic and determined at runtime
Source§fn hat(&self) -> <Rn as LieGroup>::LieAlgebra
fn hat(&self) -> <Rn as LieGroup>::LieAlgebra
Hat operator: v^∧ (vector to matrix).
For Euclidean space, this could be interpreted as a diagonal matrix or simply return the vector as a column matrix.
Source§fn small_adj(&self) -> <Rn as LieGroup>::JacobianMatrix
fn small_adj(&self) -> <Rn as LieGroup>::JacobianMatrix
Small adjoint (zero for abelian group).
Source§fn lie_bracket(&self, _other: &RnTangent) -> <Rn as LieGroup>::TangentVector
fn lie_bracket(&self, _other: &RnTangent) -> <Rn as LieGroup>::TangentVector
Lie bracket for Euclidean space.
For abelian groups: [v, w] = 0
Source§fn is_approx(&self, other: &RnTangent, tolerance: f64) -> bool
fn is_approx(&self, other: &RnTangent, tolerance: f64) -> bool
Check if the tangent vector is approximately equal to another tangent vector.
§Arguments
other- The other tangent vector to compare withtolerance- The tolerance for the comparison
Source§fn generator(&self, i: usize) -> <Rn as LieGroup>::LieAlgebra
fn generator(&self, i: usize) -> <Rn as LieGroup>::LieAlgebra
Get the i-th generator of the Lie algebra.
For Euclidean space, generators are standard basis vectors.
Source§fn normalized(&self) -> <Rn as LieGroup>::TangentVector
fn normalized(&self) -> <Rn as LieGroup>::TangentVector
Return a unit tangent vector in the same direction.
Source§fn right_jacobian(&self) -> <Rn as LieGroup>::JacobianMatrix
fn right_jacobian(&self) -> <Rn as LieGroup>::JacobianMatrix
Source§fn left_jacobian(&self) -> <Rn as LieGroup>::JacobianMatrix
fn left_jacobian(&self) -> <Rn as LieGroup>::JacobianMatrix
Source§fn right_jacobian_inv(&self) -> <Rn as LieGroup>::JacobianMatrix
fn right_jacobian_inv(&self) -> <Rn as LieGroup>::JacobianMatrix
Source§fn left_jacobian_inv(&self) -> <Rn as LieGroup>::JacobianMatrix
fn left_jacobian_inv(&self) -> <Rn as LieGroup>::JacobianMatrix
Source§fn is_dynamic() -> bool
fn is_dynamic() -> bool
impl StructuralPartialEq for Rn
Auto Trait Implementations§
impl Freeze for Rn
impl RefUnwindSafe for Rn
impl Send for Rn
impl Sync for Rn
impl Unpin for Rn
impl UnsafeUnpin for Rn
impl UnwindSafe for Rn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.