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 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.
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.
Trait Implementations§
Source§impl Clone for Transform2
impl Clone for Transform2
Source§fn clone(&self) -> Transform2
fn clone(&self) -> Transform2
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl 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
Source§fn eq(&self, other: &Transform2) -> bool
fn eq(&self, other: &Transform2) -> bool
Tests for
self and other values to be equal, and is used by ==.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
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§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 more§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).§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.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.