pub struct Index3DBuilder { /* private fields */ }Expand description
Builder for Index3D and, with the simd feature, SimdIndex3D.
§Example
use packed_spatial_index::{Box3D, Index3DBuilder};
let mut builder = Index3DBuilder::new(2);
builder.add(Box3D::new(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
builder.add(Box3D::new(5.0, 5.0, 5.0, 6.0, 6.0, 6.0));
let index = builder.finish().unwrap();
assert_eq!(
index.search(Box3D::new(0.0, 0.0, 0.0, 2.0, 2.0, 2.0)),
vec![0]
);Implementations§
Source§impl Index3DBuilder
impl Index3DBuilder
Sourcepub fn new(count: usize) -> Self
pub fn new(count: usize) -> Self
Create a builder for exactly count items with DEFAULT_NODE_SIZE.
Sourcepub fn node_size(self, node_size: usize) -> Self
pub fn node_size(self, node_size: usize) -> Self
Set the maximum number of children per tree node (clamped to [2, 65535]).
Sourcepub fn sort_key(self, key: SortKey3D) -> Self
pub fn sort_key(self, key: SortKey3D) -> Self
Choose the 3D sort key (default: SortKey3D::Hilbert).
Sourcepub fn parallel(self, parallel: bool) -> Self
pub fn parallel(self, parallel: bool) -> Self
Allow adaptive parallel builds through rayon.
Default is false. When set to true, rayon is used only when the item
count is at least the current parallel_min_items threshold.
Sourcepub fn parallel_min_items(self, min_items: usize) -> Self
pub fn parallel_min_items(self, min_items: usize) -> Self
Set the minimum count at which parallel(true)
actually enables rayon.
Sourcepub fn finish(self) -> Result<Index3D, BuildError>
pub fn finish(self) -> Result<Index3D, BuildError>
Pack the tree and return the finished 3D index.
Sourcepub fn finish_simd(self) -> Result<SimdIndex3D, BuildError>
pub fn finish_simd(self) -> Result<SimdIndex3D, BuildError>
Pack the tree into the SIMD-accelerated SoA 3D index.
§Example
use packed_spatial_index::{Index3DBuilder, Box3D};
let mut builder = Index3DBuilder::new(1);
builder.add(Box3D::new(0.0, 0.0, 0.0, 1.0, 1.0, 1.0));
let index = builder.finish_simd().unwrap();
assert_eq!(index.search(Box3D::new(0.5, 0.5, 0.5, 0.5, 0.5, 0.5)), vec![0]);Auto Trait Implementations§
impl Freeze for Index3DBuilder
impl RefUnwindSafe for Index3DBuilder
impl Send for Index3DBuilder
impl Sync for Index3DBuilder
impl Unpin for Index3DBuilder
impl UnsafeUnpin for Index3DBuilder
impl UnwindSafe for Index3DBuilder
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more