pub struct SimpleAffine<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: OutputType> SimpleAffine<F>
impl<F: OutputType> SimpleAffine<F>
pub fn new<I: InputType>( source_aabb: &Aabb2<F>, dest_aabb: &Aabb2<F>, ) -> Result<Self, BvError>
Sourcepub fn reverse_transform<I: InputType>(
&self,
x: F,
y: F,
) -> Result<[I; 2], BvError>
pub fn reverse_transform<I: InputType>( &self, x: F, y: F, ) -> Result<[I; 2], BvError>
transform from destination coordinate system to source coordinate system
Sourcepub fn reverse_transform_x<I: InputType>(&self, x: F) -> Result<I, BvError>
pub fn reverse_transform_x<I: InputType>(&self, x: F) -> Result<I, BvError>
transform from destination coordinate system to source coordinate system
Sourcepub fn reverse_transform_y<I: InputType>(&self, y: F) -> Result<I, BvError>
pub fn reverse_transform_y<I: InputType>(&self, y: F) -> Result<I, BvError>
transform from dest coordinate system to source coordinate system
Sourcepub fn transform(&self, x: F, y: F) -> [F; 2]
pub fn transform(&self, x: F, y: F) -> [F; 2]
transform from source coordinate system to dest coordinate system
Sourcepub fn transform_x(&self, x: F) -> F
pub fn transform_x(&self, x: F) -> F
transform from source coordinate system to dest coordinate system float x coordinate
Sourcepub fn transform_y(&self, y: F) -> F
pub fn transform_y(&self, y: F) -> F
transform from source coordinate system to dest coordinate system float y coordinate
Sourcepub fn transform_i<I: InputType>(&self, point: [I; 2]) -> [F; 2]
pub fn transform_i<I: InputType>(&self, point: [I; 2]) -> [F; 2]
transform from source coordinate system to dest coordinate system
Sourcepub fn transform_f(&self, point: [F; 2]) -> [F; 2]
pub fn transform_f(&self, point: [F; 2]) -> [F; 2]
transform from source coordinate system to dest coordinate system
Sourcepub fn transform_p<I: InputType>(&self, point: &Point<I>) -> [F; 2]
pub fn transform_p<I: InputType>(&self, point: &Point<I>) -> [F; 2]
transform from source coordinate system to dest coordinate system
Sourcepub fn transform_ix<I: InputType>(&self, x: I) -> F
pub fn transform_ix<I: InputType>(&self, x: I) -> F
transform from source coordinate system to dest coordinate system integer x coordinate
Sourcepub fn transform_iy<I: InputType>(&self, y: I) -> F
pub fn transform_iy<I: InputType>(&self, y: I) -> F
transform from source coordinate system to dest coordinate system integer y coordinate
Sourcepub fn transform_fx(&self, x: F) -> F
pub fn transform_fx(&self, x: F) -> F
transform from source coordinate system to destination coordinate system float x coordinate
Sourcepub fn transform_fy(&self, y: F) -> F
pub fn transform_fy(&self, y: F) -> F
transform from source coordinate system to destination coordinate system float y coordinate
Trait Implementations§
Source§impl<F: Clone + OutputType> Clone for SimpleAffine<F>
impl<F: Clone + OutputType> Clone for SimpleAffine<F>
Source§fn clone(&self) -> SimpleAffine<F>
fn clone(&self) -> SimpleAffine<F>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<F: Debug + OutputType> Debug for SimpleAffine<F>
impl<F: Debug + OutputType> Debug for SimpleAffine<F>
Source§impl<F: OutputType> Default for SimpleAffine<F>
impl<F: OutputType> Default for SimpleAffine<F>
Source§impl<F: PartialEq + OutputType> PartialEq for SimpleAffine<F>
impl<F: PartialEq + OutputType> PartialEq for SimpleAffine<F>
impl<F: OutputType> StructuralPartialEq for SimpleAffine<F>
Auto Trait Implementations§
impl<F> Freeze for SimpleAffine<F>where
F: Freeze,
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> 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
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>
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>
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