pub struct Similarity {
pub scale: f64,
pub rotation: DQuat,
pub translation: DVec3,
}Expand description
The similarity group Sim(3): uniform scale + rotation + translation.
This is the closure group of shapes defined by angles and length ratios (circles, spheres, squares, regular polygons, circular arcs): baking any similarity into them preserves their semantics.
Fields§
§scale: f64The finite, strictly positive uniform scale factor.
rotation: DQuatThe rotation part.
translation: DVec3The translation part.
Implementations§
Source§impl Similarity
impl Similarity
Sourcepub fn from_scale(scale: f64) -> Self
pub fn from_scale(scale: f64) -> Self
A pure uniform scale.
§Panics
Panics if scale is not finite and strictly positive, because zero and
orientation-reversing scales are not elements of Sim(3) as modeled
here.
Sourcepub fn transform_point(&self, p: DVec3) -> DVec3
pub fn transform_point(&self, p: DVec3) -> DVec3
Transform a point: s * (R * p) + t.
Sourcepub fn transform_direction(&self, v: DVec3) -> DVec3
pub fn transform_direction(&self, v: DVec3) -> DVec3
Transform a direction vector (rotation only, preserving unit length).
Trait Implementations§
Source§impl Clone for Similarity
impl Clone for Similarity
Source§fn clone(&self) -> Similarity
fn clone(&self) -> Similarity
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for Similarity
Source§impl Debug for Similarity
impl Debug for Similarity
Source§impl From<Rigid> for Similarity
impl From<Rigid> for Similarity
Source§impl From<Similarity> for DAffine3
impl From<Similarity> for DAffine3
Source§fn from(s: Similarity) -> Self
fn from(s: Similarity) -> Self
Source§impl From<Translation> for Similarity
impl From<Translation> for Similarity
Source§fn from(t: Translation) -> Self
fn from(t: Translation) -> Self
Source§impl Interpolatable for Similarity
impl Interpolatable for Similarity
Source§impl PartialEq for Similarity
impl PartialEq for Similarity
impl StructuralPartialEq for Similarity
Source§impl TransformGroup for Similarity
impl TransformGroup for Similarity
Source§impl TryFrom<DAffine3> for Similarity
impl TryFrom<DAffine3> for Similarity
Source§fn try_from(affine: DAffine3) -> Result<Self, Self::Error>
fn try_from(affine: DAffine3) -> Result<Self, Self::Error>
Extract a similarity from an affine transform, checking that the linear part is a uniform-scale rotation (three equal singular values, no shear, no reflection).
Source§type Error = NotSimilarity
type Error = NotSimilarity
Auto Trait Implementations§
impl Freeze for Similarity
impl RefUnwindSafe for Similarity
impl Send for Similarity
impl Sync for Similarity
impl Unpin for Similarity
impl UnsafeUnpin for Similarity
impl UnwindSafe for Similarity
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,
impl<T> ConditionalSend for Twhere
T: Send,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more§impl<T> IntoResult<T> for T
impl<T> IntoResult<T> for T
§fn into_result(self) -> Result<T, RunSystemError>
fn into_result(self) -> Result<T, RunSystemError>
§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> TransformedExt for T
impl<T> TransformedExt for T
Source§fn transformed<G>(self, transform: G) -> Transformed<Self, G>
fn transformed<G>(self, transform: G) -> Transformed<Self, G>
self wrapped with transform stored exactly as G.