Skip to main content

Transform

Struct Transform 

Source
pub struct Transform<T> {
    pub mirror: bool,
    pub rotation: Angle,
    pub magnification: T,
    pub displacement: Vec2<T>,
}

Fields§

§mirror: bool§rotation: Angle§magnification: T§displacement: Vec2<T>

Implementations§

Source§

impl<T> Transform<T>

Source

pub fn new( mirror: bool, rotation: Angle, magnification: T, displacement: Vec2<T>, ) -> Self

Source§

impl<T: Zero + One> Transform<T>

Source

pub fn identity() -> Self

Source

pub fn translate<V: Into<Vec2<T>>>(v: V) -> Self

Source

pub fn rotate(angle: Angle) -> Self

Source

pub fn rotate_ccw90() -> Self

Source

pub fn rotate_cw90() -> Self

Source

pub fn mirror_x() -> Self

Source

pub fn mirror_y() -> Self

Source

pub fn scale(factor: T) -> Self

Source§

impl<T> Transform<T>
where T: Copy + Mul<Output = T>,

Source

pub fn transform_distance(&self, d: T) -> T

Source§

impl<T: CoordType> Transform<T>

Source

pub fn rotate_around(angle: Angle, rotation_center: Point<T>) -> Self

Source

pub fn transform_point(&self, p: Point<T>) -> Point<T>

Source

pub fn then(&self, t: &Self) -> Self

Return a new transformation that is equal to applying

Trait Implementations§

Source§

impl<T: CoordType> Default for Transform<T>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<T> Freeze for Transform<T>
where T: Freeze, Vec2<T>: Freeze,

§

impl<T> RefUnwindSafe for Transform<T>

§

impl<T> Send for Transform<T>
where T: Send, Vec2<T>: Send,

§

impl<T> Sync for Transform<T>
where T: Sync, Vec2<T>: Sync,

§

impl<T> Unpin for Transform<T>
where T: Unpin, Vec2<T>: Unpin,

§

impl<T> UnsafeUnpin for Transform<T>

§

impl<T> UnwindSafe for Transform<T>
where T: UnwindSafe, Vec2<T>: 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<T> IntoEither for T

Source§

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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.