Struct spade::LastUsedVertexHintGenerator
source · pub struct LastUsedVertexHintGenerator { /* private fields */ }
Expand description
A hint generator that returns the last used vertex as hint.
This is useful if multiple insertion or locate queries are spatially close instead of randomly distributed. The run time of insertion and locate queries will be bounded by a constant in this case.
This heuristic requires only a constant additional amount of memory.
§Example
use spade::{DelaunayTriangulation, LastUsedVertexHintGenerator, Point2, Triangulation};
type LastUsedVertexTriangulation =
DelaunayTriangulation<Point2<f64>, (), (), (), LastUsedVertexHintGenerator>;
let mut triangulation = LastUsedVertexTriangulation::new();
// Start using the triangulation, e.g. by inserting vertices
triangulation.insert(Point2::new(0.0, 0.0));
Trait Implementations§
source§impl Clone for LastUsedVertexHintGenerator
impl Clone for LastUsedVertexHintGenerator
source§impl Debug for LastUsedVertexHintGenerator
impl Debug for LastUsedVertexHintGenerator
source§impl Default for LastUsedVertexHintGenerator
impl Default for LastUsedVertexHintGenerator
source§fn default() -> LastUsedVertexHintGenerator
fn default() -> LastUsedVertexHintGenerator
Returns the “default value” for a type. Read more
source§impl<S: SpadeNum> HintGenerator<S> for LastUsedVertexHintGenerator
impl<S: SpadeNum> HintGenerator<S> for LastUsedVertexHintGenerator
source§fn get_hint(&self, _: Point2<S>) -> FixedVertexHandle
fn get_hint(&self, _: Point2<S>) -> FixedVertexHandle
Returns a vertex handle that should be close to a given position. Read more
source§fn notify_vertex_lookup(&self, vertex: FixedVertexHandle)
fn notify_vertex_lookup(&self, vertex: FixedVertexHandle)
Notifies the hint generator that an element was looked up
source§fn notify_vertex_inserted(&mut self, vertex: FixedVertexHandle, _: Point2<S>)
fn notify_vertex_inserted(&mut self, vertex: FixedVertexHandle, _: Point2<S>)
Notifies the hint generator that a new vertex is inserted
source§fn notify_vertex_removed(
&mut self,
_swapped_in_point: Option<Point2<S>>,
vertex: FixedVertexHandle,
_vertex_position: Point2<S>
)
fn notify_vertex_removed( &mut self, _swapped_in_point: Option<Point2<S>>, vertex: FixedVertexHandle, _vertex_position: Point2<S> )
Notifies the hint generator that a vertex was removed
source§fn initialize_from_triangulation<TR, V>(_: &TR) -> Selfwhere
TR: Triangulation,
V: HasPosition<Scalar = S>,
fn initialize_from_triangulation<TR, V>(_: &TR) -> Selfwhere
TR: Triangulation,
V: HasPosition<Scalar = S>,
Creates a new hint generator initialized to give hints for a specific triangulation
Auto Trait Implementations§
impl !Freeze for LastUsedVertexHintGenerator
impl RefUnwindSafe for LastUsedVertexHintGenerator
impl Send for LastUsedVertexHintGenerator
impl Sync for LastUsedVertexHintGenerator
impl Unpin for LastUsedVertexHintGenerator
impl UnwindSafe for LastUsedVertexHintGenerator
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