pub struct Transform2 { /* private fields */ }Expand description
A similarity transform in the plane.
Implementations§
Source§impl Transform2
impl Transform2
Sourcepub fn translation(v: Vector2) -> Self
pub fn translation(v: Vector2) -> Self
A translation.
Sourcepub fn scaling(
centre: Point2,
factor: f64,
tol: Tolerances,
) -> OgeomResult<Self>
pub fn scaling( centre: Point2, factor: f64, tol: Tolerances, ) -> OgeomResult<Self>
Sourcepub fn line_mirror(origin: Point2, normal: Direction2) -> Self
pub fn line_mirror(origin: Point2, normal: Direction2) -> Self
Reflection in the line through origin with the given normal.
Sourcepub const fn kind(&self) -> TransformKind
pub const fn kind(&self) -> TransformKind
This transform’s classification.
Sourcepub const fn scale_factor(&self) -> f64
pub const fn scale_factor(&self) -> f64
The uniform scale factor. Negative for a point mirror.
Sourcepub const fn translation_vector(&self) -> Vector2
pub const fn translation_vector(&self) -> Vector2
The translation.
Sourcepub fn preserves_handedness(&self) -> bool
pub fn preserves_handedness(&self) -> bool
Whether this transform preserves handedness. In the plane a negative scale is a half turn, which does: only the linear part’s reflection decides.
Sourcepub fn apply_direction(
&self,
d: Direction2,
tol: Tolerances,
) -> OgeomResult<Direction2>
pub fn apply_direction( &self, d: Direction2, tol: Tolerances, ) -> OgeomResult<Direction2>
Apply to a direction, renormalizing.
§Errors
OgeomError::Construction if the result
cannot be normalized, which a valid similarity never produces.
Sourcepub fn apply_frame(&self, f: &Frame2, tol: Tolerances) -> OgeomResult<Frame2>
pub fn apply_frame(&self, f: &Frame2, tol: Tolerances) -> OgeomResult<Frame2>
Apply to a frame, transforming the origin and both axes.
§Errors
OgeomError::Construction if the
transformed axes cannot be renormalized or are no longer perpendicular.
Sourcepub fn apply_vector(&self, v: Vector2) -> Vector2
pub fn apply_vector(&self, v: Vector2) -> Vector2
Apply to a free vector.
Sourcepub fn inverse(&self) -> OgeomResult<Self>
pub fn inverse(&self) -> OgeomResult<Self>
Sourcepub fn is_equal(&self, other: &Self, tol: Tolerances) -> bool
pub fn is_equal(&self, other: &Self, tol: Tolerances) -> bool
Whether two transforms agree in effect.
Trait Implementations§
Source§impl Clone for Transform2
impl Clone for Transform2
impl Copy for Transform2
Source§impl Debug for Transform2
impl Debug for Transform2
Source§impl Default for Transform2
impl Default for Transform2
Source§impl Mul for Transform2
impl Mul for Transform2
Source§impl PartialEq for Transform2
impl PartialEq for Transform2
impl StructuralPartialEq for Transform2
Auto Trait Implementations§
impl Freeze for Transform2
impl RefUnwindSafe for Transform2
impl Send for Transform2
impl Sync for Transform2
impl Unpin for Transform2
impl UnsafeUnpin for Transform2
impl UnwindSafe for Transform2
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> Scalar 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>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.