Struct boostvoronoi::Aabb2

source ·
pub struct Aabb2<F>
where F: OutputType,
{ /* private fields */ }
Expand description

A simple 2d axis aligned bounding box.

If min_max is None no data has been assigned.

Implementations§

source§

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

source

pub fn new<I>(p1: &Point<I>, p2: &Point<I>) -> Aabb2<F>
where I: InputType,

Creates a new AABB with the limits defined by p1 & p2

source

pub fn new_from_i32<I>(x1: i32, y1: i32, x2: i32, y2: i32) -> Aabb2<F>
where I: InputType,

Creates a new AABB with i32 coordinates

source

pub fn update_point<I>(&mut self, point: &Point<I>)
where I: InputType,

source

pub fn update_coordinate<I>(&mut self, x: i32, y: i32)
where I: InputType,

source

pub fn update_vertex(&mut self, x: F, y: F)

source

pub fn update_i64(&mut self, x: i64, y: i64)

source

pub fn update_f64(&mut self, x: f64, y: f64)

source

pub fn update_line<I>(&mut self, line: &Line<I>)
where I: InputType,

source

pub fn get_high(&self) -> Option<[F; 2]>

source

pub fn get_low(&self) -> Option<[F; 2]>

source

pub fn grow_percent<I>(&mut self, percent: i32)
where I: InputType,

grows the aabb uniformly by some percent. method does nothing if not initialized

source

pub fn contains_point<I>(&self, point: &Point<I>) -> Option<bool>
where I: InputType,

returns Some(true) if the aabb contains the point (inclusive) returns None if the aabb is uninitialized

 let p0 = Point::from([0,0]);
 let p1 = Point::from([1,1]);

 let aabb = Aabb2::<f32>::new(&p0,&p1);
 assert!(aabb.contains_point(&Point::from([1,1])).unwrap_or(false));
 assert!(!aabb.contains_point(&Point::from([2,1])).unwrap_or(true));
source

pub fn contains_line<I>(&self, line: &Line<I>) -> Option<bool>
where I: InputType,

returns Some(true) if the aabb contains the line (inclusive) returns None if the aabb is uninitialized

let p0 = Point::from([0,0]);
let p1 = Point::from([10,10]);

let aabb = Aabb2::<f32>::new(&p0,&p1);
assert!( aabb.contains_line(&Line::from([1,1,10,10])).unwrap_or(false));
assert!(!aabb.contains_line(&Line::from([1,-1,10,10])).unwrap_or(true));

Trait Implementations§

source§

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

source§

fn clone(&self) -> Aabb2<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 Aabb2<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 Aabb2<F>
where F: OutputType,

source§

fn default() -> Aabb2<F>

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

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

source§

fn eq(&self, other: &Aabb2<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> Eq for Aabb2<F>
where F: Eq + OutputType,

source§

impl<F> StructuralEq for Aabb2<F>
where F: OutputType,

source§

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

Auto Trait Implementations§

§

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

§

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

§

impl<F> Sync for Aabb2<F>

§

impl<F> Unpin for Aabb2<F>

§

impl<F> UnwindSafe for Aabb2<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.