Skip to main content

Rn

Struct Rn 

Source
pub struct Rn { /* private fields */ }
Expand description

Rⁿ group element representing n-dimensional Euclidean vectors.

Internally represented using nalgebra’s DVector for dynamic sizing.

Implementations§

Source§

impl Rn

Source

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

Source

pub const DOF: usize = 0

Degrees of freedom - dimension of the tangent space Note: For Rⁿ this is dynamic and determined at runtime

Source

pub const REP_SIZE: usize = 0

Representation size - size of the underlying data representation Note: For Rⁿ this is dynamic and determined at runtime

Source

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

Source

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

Source

pub fn new( data: Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, ) -> Rn

Create a new Rⁿ element from a vector.

§Arguments
  • data - Vector data
Source

pub fn from_slice(slice: &[f64]) -> Rn

Create Rⁿ from a slice.

§Arguments
  • slice - Data slice
Source

pub fn from_vec(components: Vec<f64>) -> Rn

Create Rⁿ from individual components (up to 6D for convenience).

Source

pub fn data( &self, ) -> &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>

Get the underlying vector.

Source

pub fn dim(&self) -> usize

Get the dimension of the space.

Source

pub fn component(&self, index: usize) -> f64

Get a specific component.

Source

pub fn set_component(&mut self, index: usize, value: f64)

Set a specific component.

Source

pub fn norm(&self) -> f64

Get the norm (Euclidean length) of the vector.

Source

pub fn norm_squared(&self) -> f64

Get the squared norm of the vector.

Source

pub fn to_vector( &self, ) -> Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>

Convert Rn to a DVector

Source§

impl Rn

Source

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.

Source

pub fn zeros(dim: usize) -> Rn

Create Rn with specific dimension filled with zeros.

Source

pub fn ones(dim: usize) -> Rn

Create Rn with specific dimension filled with ones.

Source

pub fn random_with_dim(dim: usize) -> Rn

Create Rn with specific dimension and random values.

Source

pub fn jacobian_identity_with_dim( dim: usize, ) -> Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>

Create identity matrix for Jacobians with specific dimension.

Trait Implementations§

Source§

impl Clone for Rn

Source§

fn clone(&self) -> Rn

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Display for Rn

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl From<Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>> for Rn

Source§

fn from(data: Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>) -> Rn

Converts to this type from the input type.
Source§

impl Interpolatable for Rn

Source§

fn interp(&self, other: &Rn, t: f64) -> Rn

Linear interpolation in Euclidean space.

For parameter t ∈ [0,1]: interp(v₁, v₂, 0) = v₁, interp(v₁, v₂, 1) = v₂.

§Arguments
  • other - Target element for interpolation
  • t - Interpolation parameter in [0,1]
Source§

fn slerp(&self, other: &Rn, t: f64) -> Rn

Spherical linear interpolation (same as linear for Euclidean space).

Source§

impl LieGroup for Rn

Source§

fn inverse(&self, jacobian: Option<&mut <Rn as LieGroup>::JacobianMatrix>) -> Rn

Rⁿ inverse (negation for additive group).

§Arguments
  • jacobian - Optional Jacobian matrix of the inverse wrt self.
§Notes

For Euclidean space with addition: -v Jacobian of inverse: d(-v)/dv = -I

Source§

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

Logarithmic map from manifold to tangent space.

§Arguments
  • jacobian - Optional Jacobian matrix of the tangent wrt to self.
§Notes

For Euclidean space, log is identity: log(v) = v Jacobian: dlog(v)/dv = I

Source§

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>>

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 adjoint(&self) -> <Rn as LieGroup>::JacobianMatrix

Get the adjoint matrix of Rⁿ.

§Notes

For Euclidean space (abelian group), adjoint is identity.

Source§

fn random() -> Rn

Generate a random element.

Source§

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 with
  • tolerance - 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

Right plus operation: v ⊞ δ = v + δ.

For Euclidean space, this is simple vector addition.

§Arguments
  • tangent - Tangent vector perturbation
  • jacobian_self - Optional Jacobian ∂(v ⊞ δ)/∂v = I
  • jacobian_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

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₁ = I
  • jacobian_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

Left plus operation: δ ⊞ v = δ + v.

For Euclidean space (abelian group), left plus is the same as right plus.

§Arguments
  • tangent - Tangent vector perturbation
  • jacobian_tangent - Optional Jacobian ∂(δ ⊞ v)/∂δ = I
  • jacobian_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

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₁ = I
  • jacobian_other - Optional Jacobian ∂(v₁ ⊟ v₂)/∂v₂ = -I
§Notes

For abelian groups: left minus = right minus

Source§

fn tangent_dim(&self) -> usize

Get the dimension of the tangent space for this Rⁿ element.

§Returns

The actual runtime dimension of this Rⁿ element.

§Notes

Overrides the default implementation to return the dynamic size based on the actual data vector length, since Rⁿ has variable dimension.

Source§

type TangentVector = RnTangent

The tangent space vector type
Source§

type JacobianMatrix = Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>

The Jacobian matrix type
Source§

type LieAlgebra = Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>

Associated Lie algebra type
Source§

fn jacobian_identity() -> <Rn as LieGroup>::JacobianMatrix

Get the identity matrix for Jacobians. Read more
Source§

fn zero_jacobian() -> <Rn as LieGroup>::JacobianMatrix

Get a zero Jacobian matrix. Read more
Source§

fn normalize(&mut self)

Normalize/project the element to the manifold. Read more
Source§

fn is_valid(&self, _tolerance: f64) -> bool

Check if the element is approximately on the manifold.
Source§

fn plus( &self, tangent: &Self::TangentVector, jacobian_self: Option<&mut Self::JacobianMatrix>, jacobian_tangent: Option<&mut Self::JacobianMatrix>, ) -> Self

Convenience method for right_plus. Equivalent to g ⊞ φ.
Source§

fn minus( &self, other: &Self, jacobian_self: Option<&mut Self::JacobianMatrix>, jacobian_other: Option<&mut Self::JacobianMatrix>, ) -> Self::TangentVector

Convenience method for right_minus. Equivalent to g₁ ⊟ g₂.
Source§

fn between( &self, other: &Self, jacobian_self: Option<&mut Self::JacobianMatrix>, jacobian_other: Option<&mut Self::JacobianMatrix>, ) -> Self

Compute g₁⁻¹ ∘ g₂ (relative transformation). Read more
Source§

impl PartialEq for Rn

Source§

fn eq(&self, other: &Rn) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Tangent<Rn> for RnTangent

Source§

const DIM: usize = 0

Dimension of the tangent space Note: For Rⁿ this is dynamic and determined at runtime

Source§

fn exp(&self, jacobian: Option<&mut <Rn as LieGroup>::JacobianMatrix>) -> Rn

Exponential map for Euclidean space (identity).

§Arguments
  • jacobian - Optional Jacobian matrix of the Rn element wrt this.
§Notes

For Euclidean space: exp(v) = v Jacobian: dexp(v)/dv = I

Source§

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

Small adjoint (zero for abelian group).

Source§

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

Check if the tangent vector is approximately equal to another tangent vector.

§Arguments
  • other - The other tangent vector to compare with
  • tolerance - The tolerance for the comparison
Source§

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 zero() -> <Rn as LieGroup>::TangentVector

Zero tangent vector.

Source§

fn random() -> <Rn as LieGroup>::TangentVector

Random tangent vector.

Source§

fn is_zero(&self, tolerance: f64) -> bool

Check if the tangent vector is approximately zero.

Source§

fn normalize(&mut self)

Normalize the tangent vector to unit norm.

Source§

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

Right Jacobian Jr. Read more
Source§

fn left_jacobian(&self) -> <Rn as LieGroup>::JacobianMatrix

Left Jacobian Jl. Read more
Source§

fn right_jacobian_inv(&self) -> <Rn as LieGroup>::JacobianMatrix

Inverse of right Jacobian Jr⁻¹.
Source§

fn left_jacobian_inv(&self) -> <Rn as LieGroup>::JacobianMatrix

Inverse of left Jacobian Jl⁻¹.
Source§

fn is_dynamic() -> bool

Whether this tangent type has dynamic (runtime-determined) dimension. Read more
Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more