pub struct SimpleAffine<F>
where F: OutputType,
{ pub scale: [F; 2], pub to_offset: [F; 2], /* private fields */ }
Expand description

This is a simple affine transformation object. Inadvertently it also serves as a type converter F<->I<->i32 It can pan and zoom but not rotate.

Fields§

§scale: [F; 2]

A zoom scale

§to_offset: [F; 2]

The offsets needed to center coordinates of interest on the ‘dest’ coordinate system. i.e. the screen coordinate system.

Implementations§

source§

impl<F> SimpleAffine<F>
where F: OutputType,

source

pub fn new<I>( source_aabb: &Aabb2<F>, dest_aabb: &Aabb2<F> ) -> Result<SimpleAffine<F>, BvError>
where I: InputType,

source

pub fn reverse_transform<I>(&self, x: F, y: F) -> Result<[I; 2], BvError>
where I: InputType,

transform from destination coordinate system to source coordinate system

source

pub fn reverse_transform_x<I>(&self, x: F) -> Result<I, BvError>
where I: InputType,

transform from destination coordinate system to source coordinate system

source

pub fn reverse_transform_y<I>(&self, y: F) -> Result<I, BvError>
where I: InputType,

transform from dest coordinate system to source coordinate system

source

pub fn transform(&self, x: F, y: F) -> [F; 2]

transform from source coordinate system to dest coordinate system

source

pub fn transform_x(&self, x: F) -> F

transform from source coordinate system to dest coordinate system float x coordinate

source

pub fn transform_y(&self, y: F) -> F

transform from source coordinate system to dest coordinate system float y coordinate

source

pub fn transform_i<I>(&self, point: [I; 2]) -> [F; 2]
where I: InputType,

transform from source coordinate system to dest coordinate system

source

pub fn transform_f(&self, point: [F; 2]) -> [F; 2]

transform from source coordinate system to dest coordinate system

source

pub fn transform_p<I>(&self, point: &Point<I>) -> [F; 2]
where I: InputType,

transform from source coordinate system to dest coordinate system

source

pub fn transform_ix<I>(&self, x: I) -> F
where I: InputType,

transform from source coordinate system to dest coordinate system integer x coordinate

source

pub fn transform_iy<I>(&self, y: I) -> F
where I: InputType,

transform from source coordinate system to dest coordinate system integer y coordinate

source

pub fn transform_fx(&self, x: F) -> F

transform from source coordinate system to destination coordinate system float x coordinate

source

pub fn transform_fy(&self, y: F) -> F

transform from source coordinate system to destination coordinate system float y coordinate

source

pub fn zoom(&mut self, f: F)

multiply the scale by a factor f

Trait Implementations§

source§

impl<F> Clone for SimpleAffine<F>
where F: Clone + OutputType,

source§

fn clone(&self) -> SimpleAffine<F>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<F> Debug for SimpleAffine<F>
where F: Debug + OutputType,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
source§

impl<F> Default for SimpleAffine<F>
where F: OutputType,

source§

fn default() -> SimpleAffine<F>

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

impl<F> PartialEq for SimpleAffine<F>
where F: PartialEq + OutputType,

source§

fn eq(&self, other: &SimpleAffine<F>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<F> StructuralPartialEq for SimpleAffine<F>
where F: OutputType,

Auto Trait Implementations§

§

impl<F> RefUnwindSafe for SimpleAffine<F>
where F: RefUnwindSafe,

§

impl<F> Send for SimpleAffine<F>
where F: Send,

§

impl<F> Sync for SimpleAffine<F>

§

impl<F> Unpin for SimpleAffine<F>

§

impl<F> UnwindSafe for SimpleAffine<F>
where F: 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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.