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,
impl<F> Aabb2<F>where
F: OutputType,
sourcepub fn new<I>(p1: &Point<I>, p2: &Point<I>) -> Aabb2<F>where
I: InputType,
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
sourcepub fn new_from_i32<I>(x1: i32, y1: i32, x2: i32, y2: i32) -> Aabb2<F>where
I: InputType,
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
pub fn update_point<I>(&mut self, point: &Point<I>)where
I: InputType,
pub fn update_coordinate<I>(&mut self, x: i32, y: i32)where
I: InputType,
pub fn update_vertex(&mut self, x: F, y: F)
pub fn update_i64(&mut self, x: i64, y: i64)
pub fn update_f64(&mut self, x: f64, y: f64)
pub fn update_line<I>(&mut self, line: &Line<I>)where
I: InputType,
pub fn get_high(&self) -> Option<[F; 2]>
pub fn get_low(&self) -> Option<[F; 2]>
sourcepub fn grow_percent<I>(&mut self, percent: i32)where
I: InputType,
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
sourcepub fn contains_point<I>(&self, point: &Point<I>) -> Option<bool>where
I: InputType,
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));
sourcepub fn contains_line<I>(&self, line: &Line<I>) -> Option<bool>where
I: InputType,
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> Default for Aabb2<F>where
F: OutputType,
impl<F> Default for Aabb2<F>where
F: OutputType,
source§impl<F> PartialEq for Aabb2<F>where
F: PartialEq + OutputType,
impl<F> PartialEq for Aabb2<F>where
F: PartialEq + OutputType,
impl<F> Eq for Aabb2<F>where
F: Eq + OutputType,
impl<F> StructuralEq for Aabb2<F>where
F: OutputType,
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> 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
Mutably borrows from an owned value. Read more