Struct base::math::Dimension2
[−]
[src]
pub struct Dimension2<T: BaseNum> { pub width: T, pub height: T, }
A two-dimensional dimension.
Fields
width: T
height: T
Methods
impl<T: BaseNum + NumCast> Dimension2<T>
[src]
fn new(width: T, height: T) -> Self
fn area(&self) -> T::Output
Returns the area of a Dimension
fn scale(&self, scale: T) -> Dimension2<T>
Scales the Dimension2
with a scalar
fn aspect_ratio(&self) -> f32
Calculates the aspect ratio of a Dimension
fn fitting(&self, other: Dimension2<T>) -> Dimension2<T>
Shrinks a Dimension
until it fits into another Dimension
fn filling(&self, other: Dimension2<T>) -> Dimension2<T>
Expands a Dimension
until it fills another Dimension
Trait Implementations
impl<T: Eq + BaseNum> Eq for Dimension2<T>
[src]
impl<T: PartialEq + BaseNum> PartialEq for Dimension2<T>
[src]
fn eq(&self, __arg_0: &Dimension2<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Dimension2<T>) -> bool
This method tests for !=
.
impl<T: Copy + BaseNum> Copy for Dimension2<T>
[src]
impl<T: Clone + BaseNum> Clone for Dimension2<T>
[src]
fn clone(&self) -> Dimension2<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more