### pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect Source: https://docs.rs/broccoli/latest/broccoli/fn.rect.html?search=std%3A%3Avec Creates a new Rect instance using the provided start and end coordinates for both x and y axes. ```APIDOC ## Function: rect ### Description Convenience function to create a Rect. ### Signature `pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect` ### Parameters - **xstart** (T) - The starting x-coordinate. - **xend** (T) - The ending x-coordinate. - **ystart** (T) - The starting y-coordinate. - **yend** (T) - The ending y-coordinate. ### Returns - **Rect** - A new rectangle instance defined by the provided boundaries. ``` -------------------------------- ### pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect Source: https://docs.rs/broccoli/latest/broccoli/fn.rect.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Creates a new Rect instance using the provided start and end coordinates for the x and y axes. ```APIDOC ## Function: rect ### Description Convenience function to create a Rect. ### Signature `pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect` ### Parameters - **xstart** (T) - The starting x-coordinate. - **xend** (T) - The ending x-coordinate. - **ystart** (T) - The starting y-coordinate. - **yend** (T) - The ending y-coordinate. ### Returns - **Rect** - A new Rect instance defined by the provided coordinates. ``` -------------------------------- ### Create a Rect instance Source: https://docs.rs/broccoli/latest/broccoli/fn.rect.html Constructs a new Rect using the provided start and end coordinates for both axes. ```rust pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect ``` -------------------------------- ### default_axis() Source: https://docs.rs/broccoli/latest/broccoli/build/fn.default_axis.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Returns the default starting axis of a Tree, which is the X axis. ```APIDOC ## Function: default_axis ### Description Returns the default starting axis of a `Tree`. It is set to be the `X` axis, meaning the first divider is a vertical line partitioning space based on the AABB's X value. ### Signature `pub const fn default_axis() -> XAXIS` ``` -------------------------------- ### BBoxMut::new Source: https://docs.rs/broccoli/latest/broccoli/aabb/struct.BBoxMut.html?search= Creates a new instance of BBoxMut. ```APIDOC ## pub fn new(rect: Rect, inner: &'a mut T) -> BBoxMut<'a, N, T> ### Description Constructs a new BBoxMut instance with the provided rectangle and mutable reference. ### Parameters - **rect** (Rect) - The bounding box rectangle. - **inner** (&'a mut T) - A mutable reference to the inner value. ``` -------------------------------- ### default_axis() Source: https://docs.rs/broccoli/latest/broccoli/build/fn.default_axis.html Returns the default starting axis of a Tree, which is set to the X axis. ```APIDOC ## Function: default_axis ### Description The default starting axis of a `Tree`. It is set to be the `X` axis. This means that the first divider is a ‘vertical’ line since it is partitioning space based off of the aabb’s `X` value. ### Signature `pub const fn default_axis() -> XAXIS` ``` -------------------------------- ### BBox::new Source: https://docs.rs/broccoli/latest/broccoli/aabb/struct.BBox.html?search=u32+-%3E+bool Constructor for creating a new BBox instance. ```APIDOC ## pub fn new(rect: Rect, inner: T) -> BBox ### Description Creates a new BBox instance with the specified rectangle and inner value. ### Parameters - **rect** (Rect) - The bounding rectangle. - **inner** (T) - The inner value to be contained. ### Returns - **BBox** - A new BBox instance. ``` -------------------------------- ### broccoli::build::default_axis Source: https://docs.rs/broccoli/latest/broccoli/build/fn.default_axis.html?search= Returns the default starting axis of a Tree, which is the X axis. ```APIDOC ## Function: default_axis ### Description Returns the default starting axis of a `Tree`. It is set to be the `X` axis, meaning the first divider is a vertical line partitioning space based on the AABB's X value. ### Signature `pub const fn default_axis() -> XAXIS` ### Returns - **XAXIS** - The default axis constant. ``` -------------------------------- ### Naive Source: https://docs.rs/broccoli/latest/broccoli/assert/index.html A struct containing easily verifiable naive query algorithms for comparison with optimized tree implementations. ```APIDOC ## Struct Naive ### Description Contains naive query algorithms that are easily verifiable, used as a baseline for testing the correctness of broccoli tree queries. ``` -------------------------------- ### PreVec::new Source: https://docs.rs/broccoli/latest/broccoli/queries/colfind/build/struct.PreVec.html?search= Creates a new instance of PreVec. ```APIDOC ## pub fn new() -> PreVec ### Description Creates a new, empty PreVec instance. ### Returns - **PreVec** - A new instance of the PreVec struct. ``` -------------------------------- ### Range Struct Definition Source: https://docs.rs/broccoli/latest/broccoli/aabb/struct.Range.html The internal structure of the Range type, defined by start and end points. ```rust pub struct Range { pub start: T, pub end: T, } ``` -------------------------------- ### pub fn default(num_elements: usize) -> usize Source: https://docs.rs/broccoli/latest/broccoli/num_level/fn.default.html?search=std%3A%3Avec Calculates the default tree height heuristic given the number of elements. ```APIDOC ## Function: broccoli::num_level::default ### Description Use the default heuristic for tree height. ### Signature `pub fn default(num_elements: usize) -> usize` ### Parameters - **num_elements** (usize) - The number of elements to calculate the tree height for. ### Returns - **usize** - The calculated tree height. ``` -------------------------------- ### KResult::iter Source: https://docs.rs/broccoli/latest/broccoli/queries/knearest/struct.KResult.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Iterates over each group of ties starting with the closest. All elements in a single group share the same distance. ```APIDOC ## pub fn iter(&mut self) -> impl Iterator]> + FusedIterator + DoubleEndedIterator ### Description Iterates over each group of ties starting with the closest. All the elements in one group have the same distance. ``` -------------------------------- ### build_and_next Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeBuildVisitor.html?search=u32+-%3E+bool Builds the tree and returns the next result. ```APIDOC ### pub fn build_and_next(self) -> NodeBuildResult<'a, T> Performs the build operation and returns a NodeBuildResult. ``` -------------------------------- ### pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect Source: https://docs.rs/broccoli/latest/broccoli/fn.rect.html?search=u32+-%3E+bool Convenience function to create a Rect. ```APIDOC ## pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect ### Description Convenience function to create a Rect. ### Signature `pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect` ``` -------------------------------- ### TreeEmbryo implementation methods Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeEmbryo.html Methods for initializing and manipulating the TreeEmbryo during tree construction. ```rust pub fn new( bots: &'a mut [T], ) -> (TreeEmbryo<'a, T, T::Num>, TreeBuildVisitor<'a, T>) ``` ```rust pub fn with_num_level( bots: &'a mut [T], num_levels: usize, ) -> (TreeEmbryo<'a, T, T::Num>, TreeBuildVisitor<'a, T>) ``` ```rust pub fn add(&mut self, node: Node<'a, T, T::Num>) ``` ```rust pub fn div(&mut self) -> TreeEmbryo<'a, T, T::Num> ``` ```rust pub fn combine(&mut self, a: Self) -> &mut Self ``` ```rust pub fn finish(self) -> Tree<'a, T> ``` ```rust pub fn into_nodes(self) -> Vec> ``` ```rust pub fn recurse>( &mut self, a: TreeBuildVisitor<'a, T>, sorter: &mut S, ) where T: ManySwap, ``` -------------------------------- ### pub fn default(num_elements: usize) -> usize Source: https://docs.rs/broccoli/latest/broccoli/num_level/fn.default.html Calculates the default tree height heuristic for a given number of elements. ```APIDOC ## Function: default ### Description Use the default heuristic for tree height based on the provided number of elements. ### Signature `pub fn default(num_elements: usize) -> usize` ### Parameters - **num_elements** (usize) - The number of elements to calculate the tree height for. ### Returns - **usize** - The calculated default tree height. ``` -------------------------------- ### new Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeBuildVisitor.html?search=u32+-%3E+bool Creates a new TreeBuildVisitor instance. Note: This method is deprecated; use TreeEmbryo instead. ```APIDOC ### pub fn new(num_levels: usize, bots: &'a mut [T]) -> TreeBuildVisitor<'a, T> Initializes a new TreeBuildVisitor with the specified number of levels and a mutable slice of bots. ``` -------------------------------- ### TreeEmbryo::new Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeEmbryo.html?search=std%3A%3Avec Creates a new TreeEmbryo instance from a slice of bots. ```APIDOC ## pub fn new(bots: &'a mut [T]) -> (TreeEmbryo<'a, T, T::Num>, TreeBuildVisitor<'a, T>) ### Description Initializes a new TreeEmbryo with the provided bots. ### Parameters - **bots** (&'a mut [T]) - The slice of bots to be used in the tree. ``` -------------------------------- ### Search and Query Methods Source: https://docs.rs/broccoli/latest/broccoli/struct.Tree.html?search=u32+-%3E+bool Methods for k-nearest neighbor searches, ray casting, and rectangle intersection queries. ```rust pub fn find_knearest( &mut self, point: Vec2, num: usize, ktrait: impl Knearest, ) -> KResult<'_, T> ``` ```rust pub fn find_knearest_closure( &mut self, point: Vec2, num: usize, broad: impl FnMut(Vec2, AabbPin<&mut T>) -> Option, fine: impl FnMut(Vec2, AabbPin<&mut T>) -> T::Num, xline: impl FnMut(Vec2, T::Num) -> T::Num, yline: impl FnMut(Vec2, T::Num) -> T::Num, ) -> KResult<'_, T> ``` ```rust pub fn cast_ray_closure( &mut self, ray: Ray, broad: impl FnMut(&Ray, AabbPin<&mut T>) -> Option>, fine: impl FnMut(&Ray, AabbPin<&mut T>) -> CastResult, xline: impl FnMut(&Ray, T::Num) -> CastResult, yline: impl FnMut(&Ray, T::Num) -> CastResult, ) -> CastResult> ``` ```rust pub fn cast_ray>( &mut self, ray: Ray, rtrait: R, ) -> CastResult> ``` ```rust pub fn find_all_not_in_rect<'b, K: Aabb>( &'b mut self, rect: AabbPin<&mut K>, closure: impl FnMut(AabbPin<&mut K>, AabbPin<&'b mut T>), ) ``` ```rust pub fn find_all_in_rect<'b, K: Aabb>( &'b mut self, rect: AabbPin<&mut K>, closure: impl FnMut(AabbPin<&mut K>, AabbPin<&'b mut T>), ) ``` ```rust pub fn find_all_intersect_rect<'b, K: Aabb>( &'b mut self, rect: AabbPin<&mut K>, closure: impl FnMut(AabbPin<&mut K>, AabbPin<&'b mut T>), ) ``` -------------------------------- ### TreeBuildVisitor::build_and_next Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeBuildVisitor.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Advances the tree building process to the next node. ```APIDOC ## pub fn build_and_next(self) -> NodeBuildResult<'a, T> ### Description Performs the build operation and returns the result for the next node in the tree. ### Returns - `NodeBuildResult<'a, T>` - The result of the build operation. ``` -------------------------------- ### pub fn bbox_mut(rect: Rect, inner: &mut T) -> BBoxMut<'_, N, T> Source: https://docs.rs/broccoli/latest/broccoli/fn.bbox_mut.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E A shorthand constructor for creating a BBoxMut instance. ```APIDOC ## Function: bbox_mut ### Description Shorthand constructor of `BBoxMut`. ### Signature `pub fn bbox_mut(rect: Rect, inner: &mut T) -> BBoxMut<'_, N, T>` ### Parameters - **rect** (Rect) - The rectangle associated with the BBoxMut. - **inner** (&mut T) - A mutable reference to the inner value. ``` -------------------------------- ### Naive Struct Source: https://docs.rs/broccoli/latest/broccoli/assert/index.html?search=std%3A%3Avec Provides naive query algorithms that are easily verifiable, used primarily for testing and comparison against optimized tree implementations. ```APIDOC ## Struct: Naive ### Description Contains easily verifiable naive query algorithms used to validate the output of more complex tree operations. ``` -------------------------------- ### Create new Cached instance Source: https://docs.rs/broccoli/latest/broccoli/struct.Cached.html?search=std%3A%3Avec Initializes a new Cached instance by caching bboxes and sorting them based on the provided key function. ```rust pub fn new_by_cached_key( a: &'a mut [T], key: impl FnMut(&T) -> Rect, ) -> Cached<'a, N, T> ``` -------------------------------- ### default() Source: https://docs.rs/broccoli/latest/broccoli/num_level/index.html?search=std%3A%3Avec Uses the default heuristic to determine the tree height. ```APIDOC ## fn default() ### Description Use the default heuristic for tree height. ``` -------------------------------- ### pub fn bbox(rect: Rect, inner: T) -> BBox Source: https://docs.rs/broccoli/latest/broccoli/fn.bbox.html?search= A shorthand constructor used to create a new BBox instance. ```APIDOC ## pub fn bbox(rect: Rect, inner: T) -> BBox ### Description Shorthand constructor of `BBox`. ### Signature `pub fn bbox(rect: Rect, inner: T) -> BBox` ### Parameters - **rect** (Rect) - The rectangle defining the bounding box. - **inner** (T) - The inner value to be contained within the BBox. ### Returns - **BBox** - A new BBox instance. ``` -------------------------------- ### K-Nearest Neighbor Queries Source: https://docs.rs/broccoli/latest/broccoli/struct.Tree.html Methods for finding the k-nearest elements to a point. ```rust pub fn find_knearest( &mut self, point: Vec2, num: usize, ktrait: impl Knearest, ) -> KResult<'_, T> ``` ```rust pub fn find_knearest_closure( &mut self, point: Vec2, num: usize, broad: impl FnMut(Vec2, AabbPin<&mut T>) -> Option, fine: impl FnMut(Vec2, AabbPin<&mut T>) -> T::Num, xline: impl FnMut(Vec2, T::Num) -> T::Num, yline: impl FnMut(Vec2, T::Num) -> T::Num, ) -> KResult<'_, T> ``` -------------------------------- ### Using AabbPin for restricted mutation Source: https://docs.rs/broccoli/latest/broccoli/aabb/pin/index.html?search=u32+-%3E+bool Demonstrates creating AabbPin instances and using unpack_inner to safely perform swaps on inner data. ```rust use broccoli::{bbox,rect,aabb::pin::AabbPin}; let mut a=bbox(rect(0,10,0,10),0); let mut b=bbox(rect(0,10,0,10),0); let ap=AabbPin::new(&mut a); let bp=AabbPin::new(&mut b); //This is not allowed //core::mem::swap(ap,bb); //This is allowed. core::mem::swap(ap.unpack_inner(),bp.unpack_inner()); ``` -------------------------------- ### PreVec::with_capacity Source: https://docs.rs/broccoli/latest/broccoli/queries/colfind/build/struct.PreVec.html?search= Creates a new instance of PreVec with a specified initial capacity. ```APIDOC ## pub fn with_capacity(num: usize) -> PreVec ### Description Creates a new PreVec instance with the specified initial capacity. ### Parameters - **num** (usize) - Required - The initial capacity for the internal vector. ### Returns - **PreVec** - A new instance of the PreVec struct. ``` -------------------------------- ### PreVec::with_capacity Source: https://docs.rs/broccoli/latest/broccoli/queries/colfind/build/struct.PreVec.html?search=std%3A%3Avec Creates a new instance of PreVec with a specified initial capacity. ```APIDOC ## pub fn with_capacity(num: usize) -> PreVec ### Description Creates a new PreVec instance with the specified initial capacity. ### Parameters - **num** (usize) - The initial capacity to allocate. ### Returns - **PreVec** - A new instance of the PreVec struct. ``` -------------------------------- ### pub fn bbox_mut(rect: Rect, inner: &mut T) -> BBoxMut<'_, N, T> Source: https://docs.rs/broccoli/latest/broccoli/fn.bbox_mut.html A shorthand constructor used to create a new BBoxMut instance. ```APIDOC ## bbox_mut ### Description Shorthand constructor of `BBoxMut`. ### Signature `pub fn bbox_mut(rect: Rect, inner: &mut T) -> BBoxMut<'_, N, T>` ### Parameters - **rect** (Rect) - The bounding box rectangle. - **inner** (&mut T) - A mutable reference to the inner object. ``` -------------------------------- ### Assert::new Source: https://docs.rs/broccoli/latest/broccoli/assert/struct.Assert.html?search=u32+-%3E+bool Creates a new Assert instance for a given slice of items. ```APIDOC ## pub fn new(inner: &'a mut [T]) -> Self ### Description Creates a new Assert instance that wraps a mutable slice of items, allowing for verification of query results. ### Parameters - **inner** (&'a mut [T]) - The slice of items to be used for verification. ``` -------------------------------- ### Naive Struct Source: https://docs.rs/broccoli/latest/broccoli/assert/index.html?search= Contains easily verifiable naive query algorithms used for testing and validation of tree query results. ```APIDOC ## Struct: Naive ### Description Provides naive query algorithms that are easily verifiable, intended to be used as a reference implementation for testing tree query logic. ``` -------------------------------- ### TreeEmbryo::new Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeEmbryo.html?search=u32+-%3E+bool Creates a new TreeEmbryo instance from a mutable slice of bots. ```APIDOC ## pub fn new(bots: &'a mut [T]) -> (TreeEmbryo<'a, T, T::Num>, TreeBuildVisitor<'a, T>) ### Description Initializes a new TreeEmbryo builder with the provided bots. ### Parameters - **bots** (&'a mut [T]) - Required - A mutable slice of items to be included in the tree. ``` -------------------------------- ### Assert::new Source: https://docs.rs/broccoli/latest/broccoli/assert/struct.Assert.html Creates a new Assert instance for the provided slice of elements. ```APIDOC ## pub fn new(inner: &'a mut [T]) -> Self ### Description Creates a new Assert instance to verify query results for the given slice of elements. ### Parameters - **inner** (&'a mut [T]) - Required - The slice of elements to be verified. ``` -------------------------------- ### pub fn bbox_mut(rect: Rect, inner: &mut T) -> BBoxMut<'_, N, T> Source: https://docs.rs/broccoli/latest/broccoli/fn.bbox_mut.html?search=u32+-%3E+bool A shorthand constructor for the BBoxMut type. ```APIDOC ## Function: bbox_mut ### Description Shorthand constructor of `BBoxMut`. ### Signature `pub fn bbox_mut(rect: Rect, inner: &mut T) -> BBoxMut<'_, N, T>` ### Parameters - **rect** (Rect) - The rectangle defining the bounding box. - **inner** (&mut T) - A mutable reference to the inner object. ### Returns - **BBoxMut<'_, N, T>** - A new instance of BBoxMut. ``` -------------------------------- ### fn bbox(rect: Rect, inner: T) -> BBox Source: https://docs.rs/broccoli/latest/broccoli/fn.bbox.html?search=std%3A%3Avec A shorthand constructor function used to create a BBox instance. ```APIDOC ## fn bbox(rect: Rect, inner: T) -> BBox ### Description Shorthand constructor of `BBox`. ### Signature `pub fn bbox(rect: Rect, inner: T) -> BBox` ### Parameters - **rect** (Rect) - The rectangle defining the bounding box. - **inner** (T) - The inner value to be contained within the BBox. ### Returns - **BBox** - A new BBox instance. ``` -------------------------------- ### BBox::new Source: https://docs.rs/broccoli/latest/broccoli/aabb/struct.BBox.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Constructs a new BBox instance containing a rectangle and an inner value. ```APIDOC ## pub fn new(rect: Rect, inner: T) -> BBox ### Description Creates a new BBox instance with the specified rectangle and inner data. ### Parameters - **rect** (Rect) - The bounding rectangle. - **inner** (T) - The inner data associated with the bounding box. ``` -------------------------------- ### PreVec::with_capacity Source: https://docs.rs/broccoli/latest/broccoli/queries/colfind/build/struct.PreVec.html Creates a new PreVec instance with a specified initial capacity. ```APIDOC ## pub fn with_capacity(num: usize) -> PreVec ### Description Creates a new PreVec instance with the specified capacity to minimize future reallocations. ### Parameters - **num** (usize) - The initial capacity for the internal vector. ``` -------------------------------- ### pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect Source: https://docs.rs/broccoli/latest/broccoli/fn.rect.html?search= A convenience function used to create a new Rect instance with the provided x and y coordinate ranges. ```APIDOC ## Function: rect ### Description Creates a new `Rect` instance using the provided start and end coordinates for both x and y axes. ### Signature `pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect` ### Parameters - **xstart** (T) - The starting x-coordinate. - **xend** (T) - The ending x-coordinate. - **ystart** (T) - The starting y-coordinate. - **yend** (T) - The ending y-coordinate. ### Returns - **Rect** - A new rectangle defined by the input boundaries. ``` -------------------------------- ### pub fn bbox_mut(rect: Rect, inner: &mut T) -> BBoxMut<'_, N, T> Source: https://docs.rs/broccoli/latest/broccoli/fn.bbox_mut.html?search= A shorthand constructor function used to create a BBoxMut instance. ```APIDOC ## Function: bbox_mut ### Description Shorthand constructor of `BBoxMut`. ### Signature `pub fn bbox_mut(rect: Rect, inner: &mut T) -> BBoxMut<'_, N, T>` ### Parameters - **rect** (Rect) - The rectangle associated with the bounding box. - **inner** (&mut T) - A mutable reference to the inner object. ### Returns - **BBoxMut<'_, N, T>** - A new instance of BBoxMut. ``` -------------------------------- ### Naive Struct Methods Source: https://docs.rs/broccoli/latest/broccoli/assert/struct.Naive.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Methods available on the Naive struct for spatial queries. ```APIDOC ## Naive Struct Methods ### new(inner: &'a mut [T]) -> Self Creates a new Naive instance from a mutable slice. ### from_pinned(inner: AabbPin<&'a mut [T]>) -> Self Creates a new Naive instance from a pinned mutable slice. ### find_colliding_pairs(&mut self, func: impl FnMut(AabbPin<&mut T>, AabbPin<&mut T>)) Finds all colliding pairs in the collection. ### find_knearest(&mut self, point: Vec2, num: usize, ktrait: impl Knearest) -> KResult<'_, T> Finds the k-nearest neighbors to a given point. ### cast_ray>(&mut self, ray: Ray, ar: R) -> CastResult> Performs a ray cast operation against the collection. ### find_all_in_rect<'b, K: Aabb>(&'b mut self, rect: AabbPin<&mut K>, closure: impl FnMut(AabbPin<&mut K>, AabbPin<&'b mut T>)) Finds all elements contained within a specified rectangle. ### handle_nbody>(&mut self, no: &mut N) Executes an N-body simulation step. ``` -------------------------------- ### Tree Construction and Data Access Source: https://docs.rs/broccoli/latest/broccoli/struct.Tree.html?search=std%3A%3Avec Methods for creating trees, accessing underlying nodes, and managing tree data. ```rust pub fn from_nodes(nodes: Vec>) -> Self ``` ```rust pub fn into_nodes(self) -> Vec> ``` ```rust pub fn get_tree_data(&self) -> TreeData ``` ```rust pub fn from_tree_data(bots: &'a mut [T], data: &TreeData) -> Self ``` ```rust pub fn new(bots: &'a mut [T]) -> Self where T: ManySwap, ``` ```rust pub fn vistr_mut(&mut self) -> VistrMutPin<'_, Node<'a, T, T::Num>> ``` ```rust pub fn vistr(&self) -> Vistr<'_, Node<'a, T, T::Num>> ``` ```rust pub fn num_levels(&self) -> usize ``` ```rust pub fn num_nodes(&self) -> usize ``` ```rust pub fn get_nodes(&self) -> &[Node<'a, T, T::Num>] ``` ```rust pub fn get_nodes_mut(&mut self) -> AabbPin<&mut [Node<'a, T, T::Num>]> ``` -------------------------------- ### Assert::assert_query Source: https://docs.rs/broccoli/latest/broccoli/assert/struct.Assert.html?search=u32+-%3E+bool Verifies the consistency of all colfind methods. ```APIDOC ## pub fn assert_query(&mut self) ### Description Panics if a disconnect is detected between all colfind methods, ensuring the tree-based query results match the expected behavior. ``` -------------------------------- ### any Source: https://docs.rs/broccoli/latest/broccoli/aabb/pin/struct.AabbPinIter.html?search=std%3A%3Avec Tests if any element matches a predicate. ```APIDOC ## fn any(&mut self, f: F) -> bool ### Description Tests if any element of the iterator matches a predicate. ``` -------------------------------- ### Assert::assert_raycast Source: https://docs.rs/broccoli/latest/broccoli/assert/struct.Assert.html?search=u32+-%3E+bool Verifies the consistency of raycast queries. ```APIDOC ## pub fn assert_raycast(&mut self, ray: Ray, rtrait: impl RayCast) ### Description Panics if a disconnect is detected between tree and naive raycast queries. ``` -------------------------------- ### Assert::assert_k_nearest_mut Source: https://docs.rs/broccoli/latest/broccoli/assert/struct.Assert.html?search=u32+-%3E+bool Verifies the consistency of k-nearest neighbor queries. ```APIDOC ## pub fn assert_k_nearest_mut(&mut self, point: Vec2, num: usize, knear: impl Knearest) ### Description Panics if a disconnect is detected between tree and naive k-nearest neighbor queries. ``` -------------------------------- ### pub fn bbox(rect: Rect, inner: T) -> BBox Source: https://docs.rs/broccoli/latest/broccoli/fn.bbox.html A shorthand constructor function used to initialize a BBox instance with a given rectangle and inner value. ```APIDOC ## Function: bbox ### Description Shorthand constructor of `BBox`. ### Signature `pub fn bbox(rect: Rect, inner: T) -> BBox` ### Parameters - **rect** (Rect) - The rectangle defining the bounding box. - **inner** (T) - The inner value to be contained within the BBox. ### Returns - **BBox** - A new instance of BBox. ``` -------------------------------- ### Cached implementation methods Source: https://docs.rs/broccoli/latest/broccoli/struct.Cached.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Methods for building the tree and initializing the Cached struct. ```rust pub fn build<'b>(&'b mut self) -> Tree<'b, BBoxMut<'a, N, T>> ``` ```rust pub fn new_by_cached_key( a: &'a mut [T], key: impl FnMut(&T) -> Rect, ) -> Cached<'a, N, T> ``` -------------------------------- ### Visualization and Debugging Source: https://docs.rs/broccoli/latest/broccoli/struct.Tree.html Methods for drawing tree dividers and checking for tree degeneracy. ```rust pub fn draw_divider( &self, line: impl FnMut(AxisDyn, &Node<'_, T, T::Num>, &Rect, usize), rect: Rect, ) ``` ```rust pub fn is_degenerate(&self) -> bool ``` -------------------------------- ### TreeEmbryo::finish Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeEmbryo.html?search=u32+-%3E+bool Consumes the builder and returns the final Tree. ```APIDOC ## pub fn finish(self) -> Tree<'a, T> ### Description Finalizes the construction process and returns the resulting Tree structure. ``` -------------------------------- ### TreeBuildVisitor Methods Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeBuildVisitor.html?search=std%3A%3Avec Public methods available for the TreeBuildVisitor struct. ```APIDOC ## pub fn get_bots(&self) -> &[T] Returns a slice of the bots contained within the visitor. ## pub fn new(num_levels: usize, bots: &'a mut [T]) -> TreeBuildVisitor<'a, T> Creates a new TreeBuildVisitor. Note: This method is deprecated; use TreeEmbryo instead. ## pub fn get_height(&self) -> usize Returns the height of the tree being built. ## pub fn build_and_next(self) -> NodeBuildResult<'a, T> Builds the next node in the tree. ## pub fn recurse_seq>(self, sorter: &mut S, buffer: &mut Vec>) Recursively builds the tree sequentially. Note: This method is deprecated; use TreeEmbryo instead. ``` -------------------------------- ### Tree Construction and Data Management Source: https://docs.rs/broccoli/latest/broccoli/struct.Tree.html Methods for creating, serializing, and managing the underlying tree data. ```rust pub fn from_nodes(nodes: Vec>) -> Self ``` ```rust pub fn into_nodes(self) -> Vec> ``` ```rust pub fn get_tree_data(&self) -> TreeData ``` ```rust pub fn from_tree_data(bots: &'a mut [T], data: &TreeData) -> Self ``` ```rust pub fn new(bots: &'a mut [T]) -> Self where T: ManySwap, ``` -------------------------------- ### Build tree from Cached Source: https://docs.rs/broccoli/latest/broccoli/struct.Cached.html?search=std%3A%3Avec Method to finalize the construction of the tree. ```rust pub fn build<'b>(&'b mut self) -> Tree<'b, BBoxMut<'a, N, T>> ``` -------------------------------- ### Ray Casting Methods Source: https://docs.rs/broccoli/latest/broccoli/struct.Tree.html Methods for performing ray casting operations on the tree. ```rust pub fn cast_ray_closure( &mut self, ray: Ray, broad: impl FnMut(&Ray, AabbPin<&mut T>) -> Option>, fine: impl FnMut(&Ray, AabbPin<&mut T>) -> CastResult, xline: impl FnMut(&Ray, T::Num) -> CastResult>, yline: impl FnMut(&Ray, T::Num) -> CastResult, ) -> CastResult> ``` ```rust pub fn cast_ray>( &mut self, ray: Ray, rtrait: R, ) -> CastResult> ``` -------------------------------- ### Default tree height heuristic Source: https://docs.rs/broccoli/latest/broccoli/num_level/fn.default.html Calculates the recommended tree height for a given number of elements. ```rust pub fn default(num_elements: usize) -> usize ``` -------------------------------- ### Tree Traversal and Metadata Source: https://docs.rs/broccoli/latest/broccoli/struct.Tree.html Methods for accessing tree nodes and metadata. ```rust pub fn vistr_mut(&mut self) -> VistrMutPin<'_, Node<'a, T, T::Num>> ``` ```rust pub fn vistr(&self) -> Vistr<'_, Node<'a, T, T::Num>> ``` ```rust pub fn num_levels(&self) -> usize ``` ```rust pub fn num_nodes(&self) -> usize ``` ```rust pub fn get_nodes(&self) -> &[Node<'a, T, T::Num>] ``` ```rust pub fn get_nodes_mut(&mut self) -> AabbPin<&mut [Node<'a, T, T::Num>]> ``` -------------------------------- ### get_height Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeBuildVisitor.html?search=u32+-%3E+bool Returns the height of the tree being built. ```APIDOC ### pub fn get_height(&self) -> usize Returns the height of the tree structure. ``` -------------------------------- ### macro_rules! unpack Source: https://docs.rs/broccoli/latest/broccoli/macro.unpack.html?search=std%3A%3Avec A macro that accepts a comma-separated list of identifiers and expands to calls to unpack_inner. ```APIDOC ## macro_rules! unpack ### Description Convenience macro to call `unpack_inner` on any number of arguments. ### Signature `macro_rules! unpack { ( $( $x:ident ),* ) => { ... }; }` ### Usage Pass a comma-separated list of identifiers to the macro to invoke the underlying `unpack_inner` functionality for each. ``` -------------------------------- ### Assert::assert_query Source: https://docs.rs/broccoli/latest/broccoli/assert/struct.Assert.html Verifies that all colfind methods return consistent results. ```APIDOC ## pub fn assert_query(&mut self) ### Description Panics if a disconnect is detected between all colfind methods. ``` -------------------------------- ### TreeEmbryo::finish Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeEmbryo.html?search=std%3A%3Avec Finalizes the tree construction. ```APIDOC ## pub fn finish(self) -> Tree<'a, T> ### Description Consumes the TreeEmbryo and returns the constructed Tree. ``` -------------------------------- ### all Source: https://docs.rs/broccoli/latest/broccoli/aabb/pin/struct.AabbPinIter.html?search=std%3A%3Avec Tests if every element matches a predicate. ```APIDOC ## fn all(&mut self, f: F) -> bool ### Description Tests if every element of the iterator matches a predicate. ``` -------------------------------- ### Cached::build Source: https://docs.rs/broccoli/latest/broccoli/struct.Cached.html?search= Finishes building the tree from the cached data. ```APIDOC ### fn build<'a, 'b, N: Num, T>(&'b mut self) -> Tree<'b, BBoxMut<'a, N, T>> Finish building the tree. ``` -------------------------------- ### Cached::build Source: https://docs.rs/broccoli/latest/broccoli/struct.Cached.html?search=std%3A%3Avec Finishes building the tree from the cached data. ```APIDOC ### pub fn build<'b>(&'b mut self) -> Tree<'b, BBoxMut<'a, N, T>> Finish building the tree. ``` -------------------------------- ### N-Body Simulation Source: https://docs.rs/broccoli/latest/broccoli/struct.Tree.html Method for handling N-body interactions. ```rust pub fn handle_nbody>(&mut self, no: &mut N) ``` -------------------------------- ### default Source: https://docs.rs/broccoli/latest/broccoli/num_level/index.html?search=u32+-%3E+bool Calculates the default tree height based on a heuristic for the given number of elements. ```APIDOC ## default ### Description Use the default heuristic for tree height. ### Signature `fn default(num_elements: usize) -> usize` ``` -------------------------------- ### pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect Source: https://docs.rs/broccoli/latest/broccoli/fn.rect.html A convenience function provided by the broccoli crate to instantiate a new Rect object. ```APIDOC ## rect ### Description Convenience function to create a Rect. ### Signature `pub fn rect(xstart: T, xend: T, ystart: T, yend: T) -> Rect` ### Parameters - **xstart** (T) - The starting x-coordinate. - **xend** (T) - The ending x-coordinate. - **ystart** (T) - The starting y-coordinate. - **yend** (T) - The ending y-coordinate. ### Returns - **Rect** - A new Rect instance defined by the provided coordinates. ``` -------------------------------- ### with_num_elem_in_leaf(num_elements: usize, num_elem_leaf: usize) -> usize Source: https://docs.rs/broccoli/latest/broccoli/num_level/fn.with_num_elem_in_leaf.html?search= Calculates the number of levels required for a tree given the total number of elements and the desired number of elements per leaf. ```APIDOC ## Function: with_num_elem_in_leaf ### Description Specify a custom default number of elements per leaf. ### Signature `pub const fn with_num_elem_in_leaf(num_elements: usize, num_elem_leaf: usize) -> usize` ### Parameters - **num_elements** (usize) - The total number of elements in the collection. - **num_elem_leaf** (usize) - The desired number of elements per leaf node. ### Returns - **usize** - The calculated number of levels. ``` -------------------------------- ### with_num_elem_in_leaf(num_elements: usize, num_elem_leaf: usize) -> usize Source: https://docs.rs/broccoli/latest/broccoli/num_level/fn.with_num_elem_in_leaf.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Calculates the number of levels required for a tree given the total number of elements and the desired number of elements per leaf. ```APIDOC ## Function: with_num_elem_in_leaf ### Description Specify a custom default number of elements per leaf to determine the tree structure. ### Signature `pub const fn with_num_elem_in_leaf(num_elements: usize, num_elem_leaf: usize) -> usize` ### Parameters - **num_elements** (usize) - The total number of elements in the collection. - **num_elem_leaf** (usize) - The desired number of elements per leaf node. ### Returns - **usize** - The calculated number of levels for the tree. ``` -------------------------------- ### with_num_elem_in_leaf(num_elements: usize, num_elem_leaf: usize) -> usize Source: https://docs.rs/broccoli/latest/broccoli/num_level/fn.with_num_elem_in_leaf.html?search=u32+-%3E+bool Calculates the number of levels required for a tree given the total number of elements and the desired number of elements per leaf. ```APIDOC ## Function: with_num_elem_in_leaf ### Description Specify a custom default number of elements per leaf to determine the tree depth. ### Signature `pub const fn with_num_elem_in_leaf(num_elements: usize, num_elem_leaf: usize) -> usize` ### Parameters - **num_elements** (usize) - The total number of elements in the collection. - **num_elem_leaf** (usize) - The desired number of elements per leaf node. ### Returns - **usize** - The calculated number of levels for the tree. ``` -------------------------------- ### TreeEmbryo::with_num_level Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeEmbryo.html?search=u32+-%3E+bool Creates a new TreeEmbryo instance with a specified number of levels. ```APIDOC ## pub fn with_num_level(bots: &'a mut [T], num_levels: usize) -> (TreeEmbryo<'a, T, T::Num>, TreeBuildVisitor<'a, T>) ### Description Initializes a new TreeEmbryo builder with a specific depth level. ### Parameters - **bots** (&'a mut [T]) - Required - A mutable slice of items. - **num_levels** (usize) - Required - The number of levels for the tree. ``` -------------------------------- ### TreeEmbryo::with_num_level Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeEmbryo.html?search=std%3A%3Avec Creates a new TreeEmbryo instance with a specified number of levels. ```APIDOC ## pub fn with_num_level(bots: &'a mut [T], num_levels: usize) -> (TreeEmbryo<'a, T, T::Num>, TreeBuildVisitor<'a, T>) ### Description Initializes a new TreeEmbryo with a specific depth level. ### Parameters - **bots** (&'a mut [T]) - The slice of bots. - **num_levels** (usize) - The number of levels for the tree. ``` -------------------------------- ### Naive Struct Definition Source: https://docs.rs/broccoli/latest/broccoli/assert/struct.Naive.html?search= The definition of the Naive struct. ```rust pub struct Naive<'a, T> { /* private fields */ } ``` -------------------------------- ### pub const fn num_nodes(num_levels: usize) -> usize Source: https://docs.rs/broccoli/latest/broccoli/num_level/fn.num_nodes.html?search=std%3A%3Avec Calculates the number of nodes for a tree with the given height. ```APIDOC ## Function: num_nodes ### Description Returns the number of nodes for a tree with the given height. ### Signature `pub const fn num_nodes(num_levels: usize) -> usize` ### Parameters - **num_levels** (usize) - The height of the tree. ### Returns - **usize** - The total number of nodes. ``` -------------------------------- ### pub const fn num_nodes(num_levels: usize) -> usize Source: https://docs.rs/broccoli/latest/broccoli/num_level/fn.num_nodes.html?search= Calculates the number of nodes for a tree with the given height. ```APIDOC ## Function: num_nodes ### Description Calculates the total number of nodes in a tree structure given its height (number of levels). ### Signature `pub const fn num_nodes(num_levels: usize) -> usize` ### Parameters - **num_levels** (usize) - The height of the tree. ### Returns - **usize** - The total number of nodes in the tree. ``` -------------------------------- ### pub const fn num_nodes(num_levels: usize) -> usize Source: https://docs.rs/broccoli/latest/broccoli/num_level/fn.num_nodes.html?search=u32+-%3E+bool Calculates the number of nodes for a tree with the given height. ```APIDOC ## Function: num_nodes ### Description Returns the number of nodes for a tree with the given height. ### Signature `pub const fn num_nodes(num_levels: usize) -> usize` ### Parameters - **num_levels** (usize) - The height of the tree. ### Returns - **usize** - The total number of nodes in the tree. ``` -------------------------------- ### TreeEmbryo Methods Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeEmbryo.html Methods available for interacting with the TreeEmbryo struct to build and manage spatial tree structures. ```APIDOC ## TreeEmbryo Methods ### new(bots: &'a mut [T]) -> (TreeEmbryo<'a, T, T::Num>, TreeBuildVisitor<'a, T>) Creates a new TreeEmbryo instance from a slice of bots. ### with_num_level(bots: &'a mut [T], num_levels: usize) -> (TreeEmbryo<'a, T, T::Num>, TreeBuildVisitor<'a, T>) Creates a new TreeEmbryo instance with a specified number of levels. ### add(node: Node<'a, T, T::Num>) Adds a node to the TreeEmbryo. ### div() -> TreeEmbryo<'a, T, T::Num> Divides the current TreeEmbryo. ### combine(a: Self) -> &mut Self Combines the current TreeEmbryo with another. ### finish() -> Tree<'a, T> Finalizes the construction and returns the resulting Tree. ### into_nodes() -> Vec> Consumes the TreeEmbryo and returns its nodes as a vector. ### recurse>(a: TreeBuildVisitor<'a, T>, sorter: &mut S) Performs a sequential recursion on the tree using the provided visitor and sorter. ``` -------------------------------- ### fold Source: https://docs.rs/broccoli/latest/broccoli/aabb/pin/struct.AabbPinIter.html?search=std%3A%3Avec Folds every element into an accumulator by applying an operation. ```APIDOC ## fn fold(self, init: B, f: F) -> B ### Description Folds every element into an accumulator by applying an operation, returning the final result. ``` -------------------------------- ### TreeBuildVisitor::get_bots Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeBuildVisitor.html?search=Option%3CT%3E%2C+%28T+-%3E+U%29+-%3E+Option%3CU%3E Retrieves the slice of bots currently held by the visitor. ```APIDOC ## pub fn get_bots(&self) -> &[T] ### Description Returns a reference to the slice of bots contained within the TreeBuildVisitor. ### Returns - `&[T]` - A slice of the bots. ``` -------------------------------- ### Cached::new_by_cached_key Source: https://docs.rs/broccoli/latest/broccoli/struct.Cached.html Creates a new Cached instance by caching the bounding boxes one time and sorting them based on the provided key function. ```APIDOC ## pub fn new_by_cached_key(a: &'a mut [T], key: impl FnMut(&T) -> Rect) -> Cached<'a, N, T> ### Description Caches the bboxes one time and sorts them. ### Parameters - **a** (&'a mut [T]) - The mutable slice of items to be cached. - **key** (impl FnMut(&T) -> Rect) - A closure that defines how to extract a Rect from an item. ``` -------------------------------- ### Cached::new_by_cached_key Source: https://docs.rs/broccoli/latest/broccoli/struct.Cached.html?search= Creates a new Cached instance by caching the bounding boxes one time and sorting them based on the provided key function. ```APIDOC ### fn new_by_cached_key<'a, N: Num, T>(a: &'a mut [T], key: impl FnMut(&T) -> Rect) -> Cached<'a, N, T> Caches the bboxes one time and sorts them. ``` -------------------------------- ### pub fn for_every_pair(arr: AabbPin<&mut [T]>, func: impl FnMut(AabbPin<&mut T>, AabbPin<&mut T>)) Source: https://docs.rs/broccoli/latest/broccoli/queries/fn.for_every_pair.html?search= Iterates over every pair of elements in the provided AabbPin slice and applies the given closure to each pair. ```APIDOC ## Function: for_every_pair ### Description Iterate over every pair regardless if colliding or not. ### Signature `pub fn for_every_pair(arr: AabbPin<&mut [T]>, func: impl FnMut(AabbPin<&mut T>, AabbPin<&mut T>))` ### Parameters - **arr** (AabbPin<&mut [T]>) - The collection of elements to iterate over. - **func** (impl FnMut(AabbPin<&mut T>, AabbPin<&mut T>)) - The closure to execute for every pair of elements. ``` -------------------------------- ### macro_rules! unpack Source: https://docs.rs/broccoli/latest/broccoli/macro.unpack.html?search= A convenience macro that allows calling unpack_inner on multiple identifiers. ```APIDOC ## macro_rules! unpack ### Description Convenience function to call unpack_inner on any number of arguments. ### Signature ```rust macro_rules! unpack { ( $( $x:ident ),* ) => { ... }; } ``` ``` -------------------------------- ### Cached::new_by_cached_key Source: https://docs.rs/broccoli/latest/broccoli/struct.Cached.html?search=std%3A%3Avec Creates a new Cached instance by caching the provided bounding boxes one time and sorting them. ```APIDOC ### pub fn new_by_cached_key(a: &'a mut [T], key: impl FnMut(&T) -> Rect) -> Cached<'a, N, T> Caches the bboxes one time and sorts them. ``` -------------------------------- ### Tree::new Source: https://docs.rs/broccoli/latest/broccoli/struct.Tree.html Creates a new broccoli Tree from a mutable slice of elements using the default tree height heuristic. ```APIDOC ## pub fn new(bots: &'a mut [T]) -> Self ### Description Creates a new tree with the default tree height heuristic. Requires T to implement ManySwap. ### Parameters - **bots** (&'a mut [T]) - The collection of elements to be stored in the tree. ``` -------------------------------- ### DefaultNodeHandler Implementation Source: https://docs.rs/broccoli/latest/broccoli/queries/colfind/build/trait.NodeHandler.html Shows the implementation of NodeHandler for DefaultNodeHandler, requiring a CollisionHandler. ```rust impl NodeHandler for DefaultNodeHandler where C: CollisionHandler, ``` -------------------------------- ### get_bots Source: https://docs.rs/broccoli/latest/broccoli/build/struct.TreeBuildVisitor.html?search=u32+-%3E+bool Retrieves the bots currently held by the visitor. ```APIDOC ### pub fn get_bots(&self) -> &[T] Returns a slice of the bots contained within the TreeBuildVisitor. ```