pub struct KirkpatrickHierarchy { /* private fields */ }Expand description
Kirkpatrick point-location hierarchy.
Build with KirkpatrickHierarchy::build, query with
KirkpatrickHierarchy::locate.
Implementations§
Source§impl KirkpatrickHierarchy
impl KirkpatrickHierarchy
Sourcepub fn build(
vertices: &[Point2],
triangles: &[[usize; 3]],
face_labels: &[usize],
) -> Result<Self, KirkpatrickError>
pub fn build( vertices: &[Point2], triangles: &[[usize; 3]], face_labels: &[usize], ) -> Result<Self, KirkpatrickError>
Build a Kirkpatrick hierarchy from a triangulation.
vertices — the vertex positions.
triangles — list of CCW triangles as vertex index triples.
face_labels — the original face index for each triangle (use
0..triangles.len() if you just want the triangle index).
The triangulation must cover a simply-connected region (no holes). A bounding triangle is added automatically to enclose everything.
Sourcepub fn locate(&self, query: Point2) -> Result<Option<usize>, KirkpatrickError>
pub fn locate(&self, query: Point2) -> Result<Option<usize>, KirkpatrickError>
Locate a query point in the hierarchy.
Returns the face label of the containing triangle at the finest level,
or None if the point is in an exterior face (face label usize::MAX).
Returns an error if the point is outside the bounding triangle.
Sourcepub fn num_levels(&self) -> usize
pub fn num_levels(&self) -> usize
Number of levels in the hierarchy.
Sourcepub fn num_finest_triangles(&self) -> usize
pub fn num_finest_triangles(&self) -> usize
Number of triangles at the finest level.
Sourcepub fn num_coarsest_triangles(&self) -> usize
pub fn num_coarsest_triangles(&self) -> usize
Number of triangles at the coarsest level.
Sourcepub fn locate_brute_force(&self, query: Point2) -> Option<usize>
pub fn locate_brute_force(&self, query: Point2) -> Option<usize>
Brute-force locate: scan all triangles at the finest level. Used as an oracle for testing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KirkpatrickHierarchy
impl RefUnwindSafe for KirkpatrickHierarchy
impl Send for KirkpatrickHierarchy
impl Sync for KirkpatrickHierarchy
impl Unpin for KirkpatrickHierarchy
impl UnsafeUnpin for KirkpatrickHierarchy
impl UnwindSafe for KirkpatrickHierarchy
Blanket Implementations§
§impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
impl<S, A> Aggregate<Result<S, Error>> for Awhere
A: Aggregate<S>,
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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