pub struct Transform2D<S: RealField + Copy> {
pub tx: S,
pub ty: S,
pub angle: S,
}Expand description
A 2D rigid transformation (rotation + translation).
Fields§
§tx: STranslation in x direction.
ty: STranslation in y direction.
angle: SRotation angle in radians.
Implementations§
Source§impl<S: RealField + Copy> Transform2D<S>
impl<S: RealField + Copy> Transform2D<S>
Sourcepub fn translation(tx: S, ty: S) -> Self
pub fn translation(tx: S, ty: S) -> Self
Creates a new transform with translation only.
Sourcepub fn new(tx: S, ty: S, angle: S) -> Self
pub fn new(tx: S, ty: S, angle: S) -> Self
Creates a new transform with both translation and rotation.
Sourcepub fn to_isometry(&self) -> Isometry2<S>
pub fn to_isometry(&self) -> Isometry2<S>
Converts to a nalgebra Isometry2.
Sourcepub fn from_isometry(iso: &Isometry2<S>) -> Self
pub fn from_isometry(iso: &Isometry2<S>) -> Self
Creates from a nalgebra Isometry2.
Sourcepub fn transform_point(&self, x: S, y: S) -> (S, S)
pub fn transform_point(&self, x: S, y: S) -> (S, S)
Transforms a 2D point.
Sourcepub fn transform_points(&self, points: &[(S, S)]) -> Vec<(S, S)>
pub fn transform_points(&self, points: &[(S, S)]) -> Vec<(S, S)>
Transforms a vector of 2D points.
Sourcepub fn is_identity(&self, epsilon: S) -> bool
pub fn is_identity(&self, epsilon: S) -> bool
Checks if this is approximately an identity transform.
Trait Implementations§
Source§impl<S: Clone + RealField + Copy> Clone for Transform2D<S>
impl<S: Clone + RealField + Copy> Clone for Transform2D<S>
Source§fn clone(&self) -> Transform2D<S>
fn clone(&self) -> Transform2D<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl<S: Copy + RealField + Copy> Copy for Transform2D<S>
impl<S: RealField + Copy> StructuralPartialEq for Transform2D<S>
Auto Trait Implementations§
impl<S> Freeze for Transform2D<S>where
S: Freeze,
impl<S> RefUnwindSafe for Transform2D<S>where
S: RefUnwindSafe,
impl<S> Send for Transform2D<S>
impl<S> Sync for Transform2D<S>
impl<S> Unpin for Transform2D<S>where
S: Unpin,
impl<S> UnwindSafe for Transform2D<S>where
S: UnwindSafe,
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,
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>
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 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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable 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.