pub struct Projection { /* private fields */ }Expand description
Affine transformation between shape space and pixel space.
Implementations§
Source§impl Projection
impl Projection
pub fn new(scale: Vector2, translate: Vector2) -> Self
Sourcepub fn project(&self, coord: ShapePoint) -> PixelPoint
pub fn project(&self, coord: ShapePoint) -> PixelPoint
Shape coordinate → pixel coordinate (typed boundary crossing).
Sourcepub fn unproject(&self, coord: PixelPoint) -> ShapePoint
pub fn unproject(&self, coord: PixelPoint) -> ShapePoint
Pixel coordinate → shape coordinate (typed boundary crossing).
pub fn project_vector(&self, v: Vector2) -> Vector2
pub fn unproject_vector(&self, v: Vector2) -> Vector2
pub fn project_x(&self, x: f64) -> f64
pub fn project_y(&self, y: f64) -> f64
pub fn unproject_x(&self, x: f64) -> f64
pub fn unproject_y(&self, y: f64) -> f64
pub fn scale(&self) -> Vector2
pub fn translate(&self) -> Vector2
Trait Implementations§
Source§impl Clone for Projection
impl Clone for Projection
Source§fn clone(&self) -> Projection
fn clone(&self) -> Projection
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 Projection
Source§impl Debug for Projection
impl Debug for Projection
Auto Trait Implementations§
impl Freeze for Projection
impl RefUnwindSafe for Projection
impl Send for Projection
impl Sync for Projection
impl Unpin for Projection
impl UnsafeUnpin for Projection
impl UnwindSafe for Projection
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 more