[−][src]Struct zvxryb_broadphase::Layer
A group of collision data
Index
must be a type implmenting SpatialIndex
, such as Index64_3D
ID
is the type representing object IDs
Methods
impl<Index, ID> Layer<Index, ID> where
Index: SpatialIndex,
ID: ObjectID,
Bounds<Index::Point>: IndexGenerator<Index>,
[src]
Index: SpatialIndex,
ID: ObjectID,
Bounds<Index::Point>: IndexGenerator<Index>,
pub fn iter(&self) -> Iter<(Index, ID)>
[src]
Iterate over all indices in the Layer
This is primarily intended for visualization + debugging
pub fn clear(&mut self)
[src]
Clear all index-ID pairs
pub fn extend<Iter, Point_>(
&mut self,
system_bounds: Bounds<Point_>,
objects: Iter
) where
Iter: Iterator<Item = (Bounds<Point_>, ID)>,
Point_: EuclideanSpace<Scalar = f32>,
Point_::Diff: ElementWise,
Bounds<Point_>: SystemBounds<Point_, Index::Point>,
[src]
&mut self,
system_bounds: Bounds<Point_>,
objects: Iter
) where
Iter: Iterator<Item = (Bounds<Point_>, ID)>,
Point_: EuclideanSpace<Scalar = f32>,
Point_::Diff: ElementWise,
Bounds<Point_>: SystemBounds<Point_, Index::Point>,
Append multiple objects to the Layer
Complex geometry may provide multiple bounds for a single object ID; this usage would be common for static geometry, as it prevents extraneous self-collisions
pub fn merge(&mut self, other: &Layer<Index, ID>)
[src]
Merge another Layer
into this Layer
This may be used, for example, to merge static scene Layer
into the current
frames' dynamic Layer
without having to recalculate indices for the static data
pub fn par_sort(&mut self)
[src]
Sort indices to ready data for detection (parallel)
This will be called implicitly when necessary (i.e. by par_scan_filtered
, par_scan
, etc.)
pub fn sort(&mut self)
[src]
Sort indices to ready data for detection
This will be called implicitly when necessary (i.e. by scan_filtered
, scan
, etc.)
pub fn test<'a, TestGeom>(
&'a mut self,
test_geom: &TestGeom,
max_depth: Option<u32>
) -> &'a Vec<ID> where
TestGeom: TestGeometry,
[src]
&'a mut self,
test_geom: &TestGeom,
max_depth: Option<u32>
) -> &'a Vec<ID> where
TestGeom: TestGeometry,
Run a single test on some geometry
This occurs by repeatedly subdividing both this Layer
's index-ID list and the provided
test_geom
, returning any items at a given depth where both the resulting index list
is non-empty and TestGeometry::subdivide
returns a result
note: this method may do an implicit, non-parallel sort; you may call par_sort
prior
to calling this method to perform a parallel sort instead
pub fn test_box<'a, Point_>(
&'a mut self,
system_bounds: Bounds<Point_>,
test_bounds: Bounds<Point_>,
max_depth: Option<u32>
) -> &'a Vec<ID> where
Point_: EuclideanSpace<Scalar = f32> + Debug,
Point_::Diff: ElementWise + Index<usize, Output = f32> + Debug,
BoxTestGeometry<Point_>: TestGeometry,
[src]
&'a mut self,
system_bounds: Bounds<Point_>,
test_bounds: Bounds<Point_>,
max_depth: Option<u32>
) -> &'a Vec<ID> where
Point_: EuclideanSpace<Scalar = f32> + Debug,
Point_::Diff: ElementWise + Index<usize, Output = f32> + Debug,
BoxTestGeometry<Point_>: TestGeometry,
A special case of test
for bounding box tests, see BoxTestGeometry
The system_bounds
provided to this method should, in most cases, be identical to the
system_bounds
provided to extend
note: this method may do an implicit, non-parallel sort; you may call par_sort
prior
to calling this method to perform a parallel sort instead
pub fn test_ray<'a, Point_>(
&'a mut self,
system_bounds: Bounds<Point_>,
origin: Point_,
direction: Point_::Diff,
range_min: f32,
range_max: f32,
max_depth: Option<u32>
) -> &'a Vec<ID> where
Point_: EuclideanSpace<Scalar = f32> + VecDim + Debug,
Point_::Diff: ElementWise + Index<usize, Output = f32> + Debug,
RayTestGeometry<Point_>: TestGeometry,
[src]
&'a mut self,
system_bounds: Bounds<Point_>,
origin: Point_,
direction: Point_::Diff,
range_min: f32,
range_max: f32,
max_depth: Option<u32>
) -> &'a Vec<ID> where
Point_: EuclideanSpace<Scalar = f32> + VecDim + Debug,
Point_::Diff: ElementWise + Index<usize, Output = f32> + Debug,
RayTestGeometry<Point_>: TestGeometry,
A special case of test
for ray-testing, see RayTestGeometry
The system_bounds
provided to this method should, in most cases, be identical to the
system_bounds
provided to extend
note: this method may do an implicit, non-parallel sort; you may call par_sort
prior
to calling this method to perform a parallel sort instead
pub fn pick<TestGeom, GetDist>(
&mut self,
test_geom: &TestGeom,
max_dist: f32,
max_depth: Option<u32>,
get_dist: GetDist
) -> Option<(f32, ID)> where
TestGeom: TestGeometry,
GetDist: FnMut(&TestGeom, f32, ID) -> f32,
[src]
&mut self,
test_geom: &TestGeom,
max_dist: f32,
max_depth: Option<u32>,
get_dist: GetDist
) -> Option<(f32, ID)> where
TestGeom: TestGeometry,
GetDist: FnMut(&TestGeom, f32, ID) -> f32,
Run a picking or hit-test operation
This is implemented similarly to test
, but differs in that it returns only the nearest
result and may stop searching as soon as the nearest result is found
note: this method may do an implicit, non-parallel sort; you may call par_sort
prior
to calling this method to perform a parallel sort instead
pub fn pick_ray<Point_, GetDist>(
&mut self,
system_bounds: Bounds<Point_>,
origin: Point_,
direction: Point_::Diff,
max_dist: f32,
max_depth: Option<u32>,
get_dist: GetDist
) -> Option<(f32, ID, Point_)> where
Point_: EuclideanSpace<Scalar = f32> + VecDim + Debug,
Point_::Diff: VectorSpace<Scalar = f32> + ElementWise + Index<usize, Output = f32> + Debug,
RayTestGeometry<Point_>: TestGeometry,
GetDist: FnMut(&Point_, &Point_::Diff, f32, ID) -> f32,
[src]
&mut self,
system_bounds: Bounds<Point_>,
origin: Point_,
direction: Point_::Diff,
max_dist: f32,
max_depth: Option<u32>,
get_dist: GetDist
) -> Option<(f32, ID, Point_)> where
Point_: EuclideanSpace<Scalar = f32> + VecDim + Debug,
Point_::Diff: VectorSpace<Scalar = f32> + ElementWise + Index<usize, Output = f32> + Debug,
RayTestGeometry<Point_>: TestGeometry,
GetDist: FnMut(&Point_, &Point_::Diff, f32, ID) -> f32,
A special case of pick
for ray-testing, see RayTestGeometry
The system_bounds
provided to this method should, in most cases, be identical to the
system_bounds
provided to extend
note: this method may do an implicit, non-parallel sort; you may call par_sort
prior
to calling this method to perform a parallel sort instead
pub fn scan<'a>(&'a mut self) -> &'a Vec<(ID, ID)>
[src]
Detects collisions between all objects in the Layer
pub fn scan_filtered<'a, F>(&'a mut self, filter: F) -> &'a Vec<(ID, ID)> where
F: FnMut(ID, ID) -> bool,
[src]
F: FnMut(ID, ID) -> bool,
Detects collisions between all objects in the Layer
, returning only those which pass a user-specified test
Collisions are filtered prior to duplicate removal. This may be faster or slower than filtering
post-duplicate-removal (i.e. by scan().iter().filter()
) depending on the complexity
of the filter.
pub fn par_scan<'a>(&'a mut self) -> &'a Vec<(ID, ID)> where
Index: Send + Sync,
[src]
Index: Send + Sync,
Parallel version of scan
pub fn par_scan_filtered<'a, F>(&'a mut self, filter: F) -> &'a Vec<(ID, ID)> where
Index: Send + Sync,
F: Copy + Send + Sync + FnMut(ID, ID) -> bool,
[src]
Index: Send + Sync,
F: Copy + Send + Sync + FnMut(ID, ID) -> bool,
Parallel version of scan_filtered
Trait Implementations
impl<Index, ID> Clone for Layer<Index, ID> where
Index: SpatialIndex,
ID: ObjectID,
Bounds<Index::Point>: IndexGenerator<Index>,
[src]
Index: SpatialIndex,
ID: ObjectID,
Bounds<Index::Point>: IndexGenerator<Index>,
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Index: Default, ID: Default> Default for Layer<Index, ID> where
Index: SpatialIndex,
ID: ObjectID,
Bounds<Index::Point>: IndexGenerator<Index>,
[src]
Index: SpatialIndex,
ID: ObjectID,
Bounds<Index::Point>: IndexGenerator<Index>,
impl<Index, ID> Eq for Layer<Index, ID> where
Index: SpatialIndex,
ID: ObjectID,
Bounds<Index::Point>: IndexGenerator<Index>,
[src]
Index: SpatialIndex,
ID: ObjectID,
Bounds<Index::Point>: IndexGenerator<Index>,
impl<Index, ID> PartialEq<Layer<Index, ID>> for Layer<Index, ID> where
Index: SpatialIndex,
ID: ObjectID,
Bounds<Index::Point>: IndexGenerator<Index>,
[src]
Index: SpatialIndex,
ID: ObjectID,
Bounds<Index::Point>: IndexGenerator<Index>,
Auto Trait Implementations
impl<Index, ID> !RefUnwindSafe for Layer<Index, ID>
impl<Index, ID> Send for Layer<Index, ID>
impl<Index, ID> Sync for Layer<Index, ID> where
Index: Sync,
Index: Sync,
impl<Index, ID> Unpin for Layer<Index, ID> where
ID: Unpin,
Index: Unpin,
ID: Unpin,
Index: Unpin,
impl<Index, ID> UnwindSafe for Layer<Index, ID> where
ID: UnwindSafe,
Index: UnwindSafe,
ID: UnwindSafe,
Index: 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,
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.
fn to_owned(&self) -> T
[src]
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.
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>,