Struct Bound

Source
pub struct Bound {
    pub x1: f64,
    pub y1: f64,
    pub x2: f64,
    pub y2: f64,
    pub is_bounded: bool,
}
Expand description

A bounding box

Fields§

§x1: f64

smaller x

§y1: f64

smaller y

§x2: f64

bigger x

§y2: f64

bigger y

§is_bounded: bool

item is bounded

Implementations§

Source§

impl Bound

Source

pub fn new(x1: f64, y1: f64, x2: f64, y2: f64) -> Bound

create a new bound

Source

pub fn new_from_i64(x1: i64, y1: i64, x2: i64, y2: i64) -> Bound

create a new bound

Source

pub fn update(&mut self, other: &Bound)

update the bound with another one

Source

pub fn swap_if_needed(&mut self)

call this when you constructed a default bound and potentionally had zero updates

Source

pub fn width(&self) -> f64

calculate the width of the Bound

Source

pub fn height(&self) -> f64

calculate the height of the Bound

Trait Implementations§

Source§

impl Debug for Bound

Source§

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

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

impl Default for Bound

Source§

fn default() -> Bound

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

Auto Trait Implementations§

§

impl Freeze for Bound

§

impl RefUnwindSafe for Bound

§

impl Send for Bound

§

impl Sync for Bound

§

impl Unpin for Bound

§

impl UnwindSafe for Bound

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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>,

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.