Struct alga::general::Id

source ·
#[repr(C)]
pub struct Id<O: Operator = Multiplicative> { /* private fields */ }
Expand description

The universal identity element wrt. a given operator, usually noted Id with a context-dependent subscript.

By default, it is the multiplicative identity element. It represents the degenerate set containing only the identity element of any group-like structure. It has no dimension known at compile-time. All its operations are no-ops.

Implementations§

source§

impl<O: Operator> Id<O>

source

pub fn new() -> Id<O>

Creates a new identity element.

Trait Implementations§

source§

impl<O: Operator> AbsDiffEq for Id<O>

§

type Epsilon = Id<O>

Used for specifying relative comparisons.
source§

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more
source§

fn abs_diff_eq(&self, _: &Self, _: Self::Epsilon) -> bool

A test for equality that uses the absolute difference to compute the approximate equality of two numbers.
source§

fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool

The inverse of ApproxEq::abs_diff_eq.
source§

impl<O: Operator> AbstractGroupAbelian<O> for Id<O>

source§

fn prop_is_commutative_approx(args: (Self, Self)) -> bool
where Self: RelativeEq,

Returns true if the operator is commutative for the given argument tuple. Approximate equality is used for verifications.
source§

fn prop_is_commutative(args: (Self, Self)) -> bool
where Self: Eq,

Returns true if the operator is commutative for the given argument tuple.
source§

impl<O: Operator> AbstractMagma<O> for Id<O>

source§

fn operate(&self, _: &Self) -> Id<O>

Performs an operation.
source§

fn op(&self, _: O, lhs: &Self) -> Self

Performs specific operation.
source§

impl<O: Operator> AbstractMonoid<O> for Id<O>

source§

fn prop_operating_identity_element_is_noop_approx(args: (Self,)) -> bool
where Self: RelativeEq,

Checks whether operating with the identity element is a no-op for the given argument. Approximate equality is used for verifications.
source§

fn prop_operating_identity_element_is_noop(args: (Self,)) -> bool
where Self: Eq,

Checks whether operating with the identity element is a no-op for the given argument.
source§

impl<O: Operator> AbstractQuasigroup<O> for Id<O>

source§

fn prop_inv_is_latin_square_approx(args: (Self, Self)) -> bool
where Self: RelativeEq,

Returns true if latin squareness holds for the given arguments. Approximate equality is used for verifications. Read more
source§

fn prop_inv_is_latin_square(args: (Self, Self)) -> bool
where Self: Eq,

Returns true if latin squareness holds for the given arguments. Read more
source§

impl<O: Operator> AbstractSemigroup<O> for Id<O>

source§

fn prop_is_associative_approx(args: (Self, Self, Self)) -> bool
where Self: RelativeEq,

Returns true if associativity holds for the given arguments. Approximate equality is used for verifications.
source§

fn prop_is_associative(args: (Self, Self, Self)) -> bool
where Self: Eq,

Returns true if associativity holds for the given arguments.
source§

impl Add for Id<Additive>

§

type Output = Id<Additive>

The resulting type after applying the + operator.
source§

fn add(self, _: Id<Additive>) -> Id<Additive>

Performs the + operation. Read more
source§

impl AddAssign for Id<Additive>

source§

fn add_assign(&mut self, _: Id<Additive>)

Performs the += operation. Read more
source§

impl<E: EuclideanSpace> AffineTransformation<E> for Id

§

type Rotation = Id

Type of the first rotation to be applied.
§

type NonUniformScaling = Id

Type of the non-uniform scaling to be applied.
§

type Translation = Id

The type of the pure translation part of this affine transformation.
source§

fn decompose(&self) -> (Id, Id, Id, Id)

Decomposes this affine transformation into a rotation followed by a non-uniform scaling, followed by a rotation, followed by a translation.
source§

fn append_translation(&self, _: &Self::Translation) -> Self

Appends a translation to this similarity.
source§

fn prepend_translation(&self, _: &Self::Translation) -> Self

Prepends a translation to this similarity.
source§

fn append_rotation(&self, _: &Self::Rotation) -> Self

Appends a rotation to this similarity.
source§

fn prepend_rotation(&self, _: &Self::Rotation) -> Self

Prepends a rotation to this similarity.
source§

fn append_scaling(&self, _: &Self::NonUniformScaling) -> Self

Appends a scaling factor to this similarity.
source§

fn prepend_scaling(&self, _: &Self::NonUniformScaling) -> Self

Prepends a scaling factor to this similarity.
source§

fn append_rotation_wrt_point(&self, r: &Self::Rotation, p: &E) -> Option<Self>

Appends to this similarity a rotation centered at the point p, i.e., this point is left invariant. Read more
source§

impl<O: Operator> Clone for Id<O>

source§

fn clone(&self) -> Id<O>

Returns a copy 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<O: Debug + Operator> Debug for Id<O>

source§

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

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

impl<O: Operator> Display for Id<O>

source§

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

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

impl Div for Id

§

type Output = Id

The resulting type after applying the / operator.
source§

fn div(self, _: Id) -> Id

Performs the / operation. Read more
source§

impl DivAssign for Id

source§

fn div_assign(&mut self, _: Id)

Performs the /= operation. Read more
source§

impl<O: Operator> Identity<O> for Id<O>

source§

fn identity() -> Id<O>

The identity element.
source§

fn id(_: O) -> Self
where Self: Sized,

Specific identity.
source§

impl<O: Operator> JoinSemilattice for Id<O>

source§

fn join(&self, _: &Self) -> Self

Returns the join (aka. supremum) of two values.
source§

impl<O: Operator> Lattice for Id<O>

source§

fn meet_join(&self, other: &Self) -> (Self, Self)

Returns the infimum and the supremum simultaneously.
source§

fn partial_min<'a>(&'a self, other: &'a Self) -> Option<&'a Self>

Return the minimum of self and other if they are comparable.
source§

fn partial_max<'a>(&'a self, other: &'a Self) -> Option<&'a Self>

Return the maximum of self and other if they are comparable.
source§

fn partial_sort2<'a>(&'a self, other: &'a Self) -> Option<(&'a Self, &'a Self)>

Sorts two values in increasing order using a partial ordering.
source§

fn partial_clamp<'a>(&'a self, min: &'a Self, max: &'a Self) -> Option<&'a Self>

Clamp value between min and max. Returns None if value is not comparable to min or max.
source§

impl<O: Operator> MeetSemilattice for Id<O>

source§

fn meet(&self, _: &Self) -> Self

Returns the meet (aka. infimum) of two values.
source§

impl Mul for Id

§

type Output = Id

The resulting type after applying the * operator.
source§

fn mul(self, _: Id) -> Id

Performs the * operation. Read more
source§

impl MulAssign for Id

source§

fn mul_assign(&mut self, _: Id)

Performs the *= operation. Read more
source§

impl One for Id

source§

fn one() -> Id

Returns the multiplicative identity element of Self, 1. Read more
source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
source§

fn is_one(&self) -> bool
where Self: PartialEq,

Returns true if self is equal to the multiplicative identity. Read more
source§

impl<O: Operator> PartialEq for Id<O>

source§

fn eq(&self, _: &Id<O>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<O: Operator> PartialOrd for Id<O>

source§

fn partial_cmp(&self, _: &Id<O>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

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

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

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

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

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

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

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

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<E: EuclideanSpace> ProjectiveTransformation<E> for Id

source§

fn inverse_transform_point(&self, pt: &E) -> E

Applies this group’s two_sided_inverse action on a point from the euclidean space.
source§

fn inverse_transform_vector(&self, v: &E::Coordinates) -> E::Coordinates

Applies this group’s two_sided_inverse action on a vector from the euclidean space. Read more
source§

impl<O: Operator> RelativeEq for Id<O>

source§

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more
source§

fn relative_eq(&self, _: &Self, _: Self::Epsilon, _: Self::Epsilon) -> bool

A test for equality that uses a relative comparison if the values are far apart.
source§

fn relative_ne( &self, other: &Rhs, epsilon: Self::Epsilon, max_relative: Self::Epsilon ) -> bool

The inverse of ApproxEq::relative_eq.
source§

impl<E: EuclideanSpace> Rotation<E> for Id

source§

fn powf(&self, _: E::RealField) -> Option<Self>

Raises this rotation to a power. If this is a simple rotation, the result must be equivalent to multiplying the rotation angle by n.
source§

fn rotation_between(a: &E::Coordinates, b: &E::Coordinates) -> Option<Self>

Computes a simple rotation that makes the angle between a and b equal to zero, i.e., b.angle(a * delta_rotation(a, b)) = 0. If a and b are collinear, the computed rotation may not be unique. Returns None if no such simple rotation exists in the subgroup represented by Self.
source§

fn scaled_rotation_between( a: &E::Coordinates, b: &E::Coordinates, _: E::RealField ) -> Option<Self>

Computes the rotation between a and b and raises it to the power n. Read more
source§

impl<E: EuclideanSpace> Scaling<E> for Id

source§

fn to_real(&self) -> E::RealField

Converts this scaling factor to a real. Same as self.to_superset().
source§

fn from_real(r: E::RealField) -> Option<Self>

Attempts to convert a real to an element of this scaling subgroup. Same as Self::from_superset(). Returns None if no such scaling is possible for this subgroup.
source§

fn powf(&self, n: E::RealField) -> Option<Self>

Raises the scaling to a power. The result must be equivalent to self.to_superset().powf(n). Returns None if the result is not representable by Self.
source§

fn scale_between(a: &E::Coordinates, b: &E::Coordinates) -> Option<Self>

The scaling required to make a have the same norm as b, i.e., |b| = |a| * norm_ratio(a, b).
source§

impl<E: EuclideanSpace> Similarity<E> for Id

§

type Scaling = Id

The type of the pure (uniform) scaling part of this similarity transformation.
source§

fn translation(&self) -> Self::Translation

The pure translational component of this similarity transformation.
source§

fn rotation(&self) -> Self::Rotation

The pure rotational component of this similarity transformation.
source§

fn scaling(&self) -> Self::Scaling

The pure scaling component of this similarity transformation.
source§

fn translate_point(&self, pt: &E) -> E

Applies this transformation’s pure translational part to a point.
source§

fn rotate_point(&self, pt: &E) -> E

Applies this transformation’s pure rotational part to a point.
source§

fn scale_point(&self, pt: &E) -> E

Applies this transformation’s pure scaling part to a point.
source§

fn rotate_vector(&self, pt: &E::Coordinates) -> E::Coordinates

Applies this transformation’s pure rotational part to a vector.
source§

fn scale_vector(&self, pt: &E::Coordinates) -> E::Coordinates

Applies this transformation’s pure scaling part to a vector.
source§

fn inverse_translate_point(&self, pt: &E) -> E

Applies this transformation inverse’s pure translational part to a point.
source§

fn inverse_rotate_point(&self, pt: &E) -> E

Applies this transformation inverse’s pure rotational part to a point.
source§

fn inverse_scale_point(&self, pt: &E) -> E

Applies this transformation inverse’s pure scaling part to a point.
source§

fn inverse_rotate_vector(&self, pt: &E::Coordinates) -> E::Coordinates

Applies this transformation inverse’s pure rotational part to a vector.
source§

fn inverse_scale_vector(&self, pt: &E::Coordinates) -> E::Coordinates

Applies this transformation inverse’s pure scaling part to a vector.
source§

impl<O: Operator, T: PartialEq + Identity<O>> SubsetOf<T> for Id<O>

source§

fn to_superset(&self) -> T

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

fn is_in_subset(t: &T) -> bool

Checks if element is actually part of the subset Self (and can be converted to it).
source§

unsafe fn from_superset_unchecked(_: &T) -> Self

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

fn from_superset(element: &T) -> Option<Self>

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

impl<E: EuclideanSpace> Transformation<E> for Id

source§

fn transform_point(&self, pt: &E) -> E

Applies this group’s action on a point from the euclidean space.
source§

fn transform_vector(&self, v: &E::Coordinates) -> E::Coordinates

Applies this group’s action on a vector from the euclidean space. Read more
source§

impl<E: EuclideanSpace> Translation<E> for Id

source§

fn to_vector(&self) -> E::Coordinates

Converts this translation to a vector.
source§

fn from_vector(v: E::Coordinates) -> Option<Self>

Attempts to convert a vector to this translation. Returns None if the translation represented by v is not part of the translation subgroup represented by Self.
source§

fn powf(&self, n: E::RealField) -> Option<Self>

Raises the translation to a power. The result must be equivalent to self.to_superset() * n. Returns None if the result is not representable by Self.
source§

fn translation_between(a: &E, b: &E) -> Option<Self>

The translation needed to make a coincide with b, i.e., b = a * translation_to(a, b).
source§

impl<O: Operator> TwoSidedInverse<O> for Id<O>

source§

fn two_sided_inverse(&self) -> Self

Returns the two_sided_inverse of self, relative to the operator O. Read more
source§

fn two_sided_inverse_mut(&mut self)

In-place inversion of self, relative to the operator O. Read more
source§

impl<O: Operator> UlpsEq for Id<O>

source§

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more
source§

fn ulps_eq(&self, _: &Self, _: Self::Epsilon, _: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.
source§

fn ulps_ne(&self, other: &Rhs, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of ApproxEq::ulps_eq.
source§

impl Zero for Id<Additive>

source§

fn zero() -> Id<Additive>

Returns the additive identity element of Self, 0. Read more
source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
source§

impl<O: Operator> AbstractGroup<O> for Id<O>

source§

impl<O: Operator> AbstractLoop<O> for Id<O>

source§

impl<O: Operator> Copy for Id<O>

source§

impl<E: EuclideanSpace> DirectIsometry<E> for Id

source§

impl<O: Operator> Eq for Id<O>

source§

impl<E: EuclideanSpace> Isometry<E> for Id

source§

impl<E: EuclideanSpace> OrthogonalTransformation<E> for Id

Auto Trait Implementations§

§

impl<O> Freeze for Id<O>

§

impl<O> RefUnwindSafe for Id<O>
where O: RefUnwindSafe,

§

impl<O> Send for Id<O>
where O: Send,

§

impl<O> Sync for Id<O>
where O: Sync,

§

impl<O> Unpin for Id<O>
where O: Unpin,

§

impl<O> UnwindSafe for Id<O>
where O: UnwindSafe,

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> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

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

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

§

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§

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

§

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

§

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<T> AdditiveMagma for T

source§

impl<T> AdditiveMonoid for T

source§

impl<T> AdditiveSemigroup for T

source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

source§

impl<T, Right> ClosedDiv<Right> for T
where T: Div<Right, Output = T> + DivAssign<Right>,

source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

source§

impl<T> MultiplicativeGroup for T

source§

impl<T> MultiplicativeGroupAbelian for T

source§

impl<T> MultiplicativeLoop for T

source§

impl<T> MultiplicativeMagma for T

source§

impl<T> MultiplicativeMonoid for T

source§

impl<T> MultiplicativeQuasigroup for T

source§

impl<T> MultiplicativeSemigroup for T