Struct box_intersect_ze::set::BBoxSet[][src]

pub struct BBoxSet<B: BBox, ID> {
    pub boxes: Vec<(B, ID)>,
}

A generic set of BBoxes 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]

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 be PartialOrd

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]

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]

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 the Rng 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]

Auto Trait Implementations

impl<B, ID> RefUnwindSafe for BBoxSet<B, ID> where
    B: RefUnwindSafe,
    ID: RefUnwindSafe

impl<B, ID> Send for BBoxSet<B, ID> where
    B: Send,
    ID: Send

impl<B, ID> Sync for BBoxSet<B, ID> where
    B: Sync,
    ID: Sync

impl<B, ID> Unpin for BBoxSet<B, ID> where
    B: Unpin,
    ID: Unpin

impl<B, ID> UnwindSafe for BBoxSet<B, ID> where
    B: UnwindSafe,
    ID: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,