[][src]Struct simple_octree::Octree

pub struct Octree<D> where
    D: Default
{ /* fields omitted */ }

A barebones octree offering just the methods required for accessing and modifying its contents. Other management structures/functions will be needed to make this more useful, especially for the purpose of querying contents.

Methods

impl<D, S, T> Octree<ManagedOctreeData<D, S>> where
    D: Default + Empty + Len + Clear + IntoIterator<Item = T> + OctreeCollection<T>,
    T: CentredItem<S>,
    S: Default + Copy + One + PartialOrd + Add<S, Output = S> + Sub<S, Output = S> + Div<S, Output = S>, 
[src]

#[must_use]pub fn new_managed(centre: (S, S, S), half_length: S) -> Self[src]

#[must_use]pub fn with_max_size(self, max_size: usize) -> Self[src]

Set max_size

#[must_use]pub fn with_drop_below_size(self, drop_below_size: usize) -> Self[src]

Set drop_below_size

Panics when set to 0

pub fn add(&mut self, item: T)[src]

Adds data to the node without flushing/rebalancing the tree.

pub fn clear_data(&mut self)[src]

Clears data from the node (not the whole tree)

pub fn rebalance(&mut self)[src]

impl<D> Octree<D> where
    D: Default
[src]

#[must_use]pub fn new() -> Self[src]

#[must_use]pub fn new_with_data(data: D) -> Self[src]

pub fn add_child(
    &mut self,
    idx: usize,
    child: Self
) -> Result<&mut Self, AddChildError>
[src]

Adds and returns a reference to a child at a particular index.

Errors

Returns an error if the idx is out of range (i.e. idx >= 8) or if the child is already added.

pub fn add_child_at_pos(
    &mut self,
    pos_x: bool,
    pos_y: bool,
    pos_z: bool,
    child: Self
) -> Result<&mut Self, AddChildError>
[src]

Adds and returns a reference to a child at an index based on whether the child is at the positive or negative side of each axis.

Arguments

  • pos_x - positive x axis if true, negative if false.
  • pos_y - positive y axis if true, negative if false.
  • pos_z - positive z axis if true, negative if false.

Errors

Returns an error if the child is already added.

pub fn remove_child(&mut self, idx: usize) -> Option<Self>[src]

Removes a child and returns the owned value, if it exists.

pub fn remove_child_at_pos(
    &mut self,
    pos_x: bool,
    pos_y: bool,
    pos_z: bool
) -> Option<Self>
[src]

Removes a child at an index based on whether the child is at the positive or negative side of each access and returns the owned value, if it exists.

Arguments

  • pos_x - positive x axis if true, negative if false.
  • pos_y - positive y axis if true, negative if false.
  • pos_z - positive z axis if true, negative if false.

#[must_use]pub fn get_child(&self, idx: usize) -> Option<&Self>[src]

Gets a reference to a child given an index.

#[must_use]pub fn get_child_mut(&mut self, idx: usize) -> Option<&mut Self>[src]

Gets a mutable reference to a child given an index.

#[must_use]pub fn get_child_at_pos(
    &self,
    pos_x: bool,
    pos_y: bool,
    pos_z: bool
) -> Option<&Self>
[src]

Gets a reference to a child given whether the child is at the positive or negative side of an axis.

Arguments

  • pos_x - positive x axis if true, negative if false.
  • pos_y - positive y axis if true, negative if false.
  • pos_z - positive z axis if true, negative if false.

#[must_use]pub fn get_child_mut_at_pos(
    &mut self,
    pos_x: bool,
    pos_y: bool,
    pos_z: bool
) -> Option<&mut Self>
[src]

Gets a mutable reference to a child given whether the child is at the positive or negative side of an axis.

Arguments

  • pos_x - positive x axis if true, negative if false.
  • pos_y - positive y axis if true, negative if false.
  • pos_z - positive z axis if true, negative if false.

#[must_use]pub fn get_data(&self) -> &D[src]

Gets a reference to the underlying data in the node.

#[must_use]pub fn get_data_mut(&mut self) -> &mut D[src]

Gets a mutable reference to the underlying data in the node.

Trait Implementations

impl<D: Default> Default for Octree<D> where
    D: Default
[src]

Auto Trait Implementations

impl<D> RefUnwindSafe for Octree<D> where
    D: RefUnwindSafe

impl<D> Send for Octree<D> where
    D: Send

impl<D> Sync for Octree<D> where
    D: Sync

impl<D> Unpin for Octree<D> where
    D: Unpin

impl<D> UnwindSafe for Octree<D> where
    D: 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, 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.