[−][src]Struct smeagol::BoundingBox
A rectangular region of a Life grid.
Methods
impl BoundingBox
[src]
pub fn new(upper_left: Position, lower_right: Position) -> Self
[src]
Creates a new bounding box with the given upper-left corner position and lower-right corner position.
Examples
// create a bounding box around a single position let pos = smeagol::Position::new(0, 0); let bounding_box = smeagol::BoundingBox::new(pos, pos);
pub fn upper_left(&self) -> Position
[src]
Returns the upper left corner position of the bounding box.
pub fn lower_right(&self) -> Position
[src]
Returns the lower right corner position of the bounding box.
pub fn combine(&self, other: BoundingBox) -> Self
[src]
Combines two bounding boxes, returning a bounding box that surrounds both boxes.
Examples
let p0 = smeagol::Position::new(0, 0); let p1 = smeagol::Position::new(1, 1); let bbox0 = smeagol::BoundingBox::new(p0, p0); let bbox1 = smeagol::BoundingBox::new(p1, p1); assert_eq!(bbox0.combine(bbox1), smeagol::BoundingBox::new(p0, p1));
pub fn intersect(&self, other: BoundingBox) -> Option<Self>
[src]
Intersects two bounding boxes, returning a bounding box that both boxes contain.
pub fn offset(&self, x_offset: i64, y_offset: i64) -> Self
[src]
Offsets the bounding box by the given amounts in the x and y directions.
Examples
let p0 = smeagol::Position::new(0, 0); let p1 = smeagol::Position::new(2, 2); let bbox = smeagol::BoundingBox::new(p0, p1); let offset_bbox = bbox.offset(3, 4);
pub fn pad(&self, amount: i64) -> Self
[src]
Trait Implementations
impl Eq for BoundingBox
[src]
impl Copy for BoundingBox
[src]
impl PartialOrd<BoundingBox> for BoundingBox
[src]
fn partial_cmp(&self, other: &BoundingBox) -> Option<Ordering>
[src]
fn lt(&self, other: &BoundingBox) -> bool
[src]
fn le(&self, other: &BoundingBox) -> bool
[src]
fn gt(&self, other: &BoundingBox) -> bool
[src]
fn ge(&self, other: &BoundingBox) -> bool
[src]
impl PartialEq<BoundingBox> for BoundingBox
[src]
fn eq(&self, other: &BoundingBox) -> bool
[src]
fn ne(&self, other: &BoundingBox) -> bool
[src]
impl Ord for BoundingBox
[src]
fn cmp(&self, other: &BoundingBox) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl Clone for BoundingBox
[src]
fn clone(&self) -> BoundingBox
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for BoundingBox
[src]
impl Hash for BoundingBox
[src]
Auto Trait Implementations
impl Send for BoundingBox
impl Sync for BoundingBox
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> FromCast for T
[src]
impl<T, U> Cast for T where
U: FromCast<T>,
[src]
U: FromCast<T>,