Struct box_intersect_ze::set::BBoxSet [−][src]
A generic set of BBox
es of type B
with identifiers of type ID
Fields
boxes: Vec<(B, ID)>
Implementations
impl<B, ID> BBoxSet<B, ID> where
B: BBox,
ID: Copy + PartialEq,
B::Num: PartialOrd,
[src]
B: BBox,
ID: Copy + PartialEq,
B::Num: PartialOrd,
pub fn new() -> Self
[src]
Creates a new, empty set. Prefer BBoxSet::with_capacity
.
pub fn with_capacity(capacity: usize) -> Self
[src]
Creates a new, empty set with the specified capacity. See Vec::with_capacity
.
pub fn push(&mut self, id: ID, bbox: B)
[src]
Adds a box with an identifier to the set.
id
must be a unique identifier for that box. If you want to use algorithms other than brute force to find intersections,ID
must bePartialOrd
pub fn clear(&mut self)
[src]
Removes all boxes from the set.
pub fn sort(&mut self)
[src]
Sorts the boxes in the set by their low boundaries in dimension 0. Needed for the intersection finding algorithms.
pub fn len(&self) -> usize
[src]
Returns the number of boxes in the set.
pub fn get(&self, idx: usize) -> (B, ID)
[src]
Returns the box at the given index and its identifier.
pub fn find(&self, id: ID) -> Option<B>
[src]
Performs a linear search for the box with the given identifier.
Returns Some
if found, None
otherwise.
pub fn empty(&self) -> bool
[src]
Returns true
if the set is empty.
pub fn filter<P>(&self, pred: P) -> Self where
P: FnMut(&&(B, ID)) -> bool,
[src]
P: FnMut(&&(B, ID)) -> bool,
Returns a subset of the set, containing only those boxes that match the given predicate. If the set is sorted, the sorting is preserved in the subset.
pub fn partition<P>(&self, pred: P) -> (Self, Self) where
P: FnMut(&&(B, ID)) -> bool,
[src]
P: FnMut(&&(B, ID)) -> bool,
Returns a pair of subsets of the set, containing:
- those boxes for which the given predicate returns
true
- those for which it returns
false
If the set is sorted, the sorting is preserved in the subsets.
pub fn approx_median<R: Rng>(&self, dim: usize, rand: &mut R) -> B::Num
[src]
Returns an approximate median of the low boundaries in dimension dim
of the boxes,
obtained by recursively calculating medians of three (medians of …) random elements
rand
must be a random number generator implementing theRng
trait.
Trait Implementations
impl<B: Clone + BBox, ID: Clone> Clone for BBoxSet<B, ID>
[src]
impl<B, ID> Debug for BBoxSet<B, ID> where
B: BBox + Debug,
ID: Debug,
[src]
B: BBox + Debug,
ID: Debug,
Auto Trait Implementations
impl<B, ID> RefUnwindSafe for BBoxSet<B, ID> where
B: RefUnwindSafe,
ID: RefUnwindSafe,
B: RefUnwindSafe,
ID: RefUnwindSafe,
impl<B, ID> Send for BBoxSet<B, ID> where
B: Send,
ID: Send,
B: Send,
ID: Send,
impl<B, ID> Sync for BBoxSet<B, ID> where
B: Sync,
ID: Sync,
B: Sync,
ID: Sync,
impl<B, ID> Unpin for BBoxSet<B, ID> where
B: Unpin,
ID: Unpin,
B: Unpin,
ID: Unpin,
impl<B, ID> UnwindSafe for BBoxSet<B, ID> where
B: UnwindSafe,
ID: UnwindSafe,
B: UnwindSafe,
ID: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,