pub struct DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter: InnerOuterMarker> { /* private fields */ }
Expand description

Internal type definition that is only exposed for documentation purposes.

Rust will currently not generate documentation for type definitions depending pub(crate) types, see #32077.

Do not use these types. Their removal from the public API will not be considered a breaking change.

Refer to the handles module for the handle types that should be used instead.

Implementations§

source§

impl<'a, V, DE, UE, F, Type: Copy + Default, InnerOuter: InnerOuterMarker> DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>

source

pub fn fix(&self) -> FixedHandleImpl<Type, InnerOuter>

Converts this dynamic handle to its fixed variant.

See also the handles module

source

pub fn index(&self) -> usize

Returns the internal index of this element.

Indices of the same handle type are guaranteed to be unique (e.g. different vertices will have different indices from each other).

Indices will always be in the interval 0 .. number_of_elements (e.g. the number of directed edges).

Adding vertices will not change any indices. Vertex removal does affect indices - the index of elements may change to swap-fill any gaps that were created.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, DirectedEdgeTag, InnerTag>

source

pub fn vertices(&self) -> [VertexHandle<'a, V, DE, UE, F>; 2]

Returns the edge’s two vertices.

The first vertex is self.from(), the second vertex is self.to().

source

pub fn from(&self) -> VertexHandle<'a, V, DE, UE, F>

Returns the edge’s origin vertex.

source

pub fn to(&self) -> VertexHandle<'a, V, DE, UE, F>

Returns the edge’s destination vertex.

source

pub fn rev(&self) -> Self

Returns this edge in reversed direction.

source

pub fn opposite_vertex(&self) -> Option<VertexHandle<'a, V, DE, UE, F>>

Returns the vertex which lies opposite of this edge.

This is equal to calling self.prev().from() or self.next().to(). Returns None if this edge is part of the convex hull.

source

pub fn next(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>

Returns the oriented next edge.

The oriented next edge shares the same face as this edge. When traversing the face’s edges in oriented order, this edge is the predecessor of the oriented next edge. “Oriented” means counterclockwise for right handed coordinate systems.

source

pub fn prev(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>

Returns the oriented previous edge.

The oriented previous edge shares the same face as this edge. When traversing the face’s edges in oriented order, this edge is the successor of the oriented previous edge. “Oriented” means counterclockwise for right handed coordinate systems.

source

pub fn face(&self) -> FaceHandle<'a, PossiblyOuterTag, V, DE, UE, F>

Returns the face located to the left of this edge.

source

pub fn cw(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>

Returns the next edge in clockwise direction.

Note that this assumes that you use a right handed coordinate system, otherwise the sense of orientation is inverted.

source

pub fn ccw(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>

Returns the next edge in counter clockwise direction.

Note that this assumes that you use a right handed coordinate system, otherwise the sense of orientation is inverted.

source

pub fn data(&self) -> &'a DE

Returns a reference to the data associated with this directed edge.

Use Triangulation::directed_edge_data_mut to modify the edge data.

source

pub fn as_undirected(self) -> UndirectedEdgeHandle<'a, V, DE, UE, F>

Converts this directed edge handle into an undirected edge handle.

See also the handles module.

source

pub fn is_outer_edge(&self) -> bool

Returns true if this edge is adjacent to the outer face.

source

pub fn is_part_of_convex_hull(&self) -> bool

Returns true if either this edge or its reversed edge is adjacent to the outer face.

source

pub fn as_voronoi_edge(&self) -> DirectedVoronoiEdge<'a, V, DE, UE, F>

Converts this edge into its dual voronoi edge.

See also as_delaunay_edge.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, DirectedEdgeTag, InnerTag>
where V: HasPosition,

source

pub fn positions(&self) -> [Point2<<V as HasPosition>::Scalar>; 2]

Returns the start and end position of this edge.

The first returned position is self.from().position(), the second is self.to().position().

source

pub fn opposite_position(&self) -> Option<Point2<V::Scalar>>

Returns the position of the vertex opposite of this edge.

See also opposite_vertex(). Returns None if this edge is an outer edge.

source

pub fn length_2(&self) -> V::Scalar

Returns the squared length of this edge.

source

pub fn side_query(&self, query_point: Point2<V::Scalar>) -> LineSideInfo

Identifies on which side of this edge a point lies.

source

pub fn project_point( &self, query_point: Point2<V::Scalar> ) -> PointProjection<V::Scalar>

Indicates the position of a point being projected onto this edge.

A point’s projection can either come before, on or behind this edge. Note that this method may return inaccurate results due to rounding issues.

before on edge behind

An image displaying differently colored areas which would result in different point projections

Example
use spade::{Point2, Triangulation, DelaunayTriangulation};

let from = Point2::new(0.0, 0.0);
let to = Point2::new(2.0, 0.0);

let mut triangulation: DelaunayTriangulation<_> = Default::default();
let v0 = triangulation.insert(from)?;
let v1 = triangulation.insert(to)?;
// This edge goes from "from" to "to"
let edge = triangulation.get_edge_from_neighbors(v0, v1).unwrap();

// These vertices are all projected before the edge
assert!(edge.project_point(Point2::new(-0.2, 0.0)).is_before_edge());
assert!(edge.project_point(Point2::new(-1002.0, -12.0)).is_before_edge());

// These vertices are all projected onto the edge
assert!(edge.project_point(Point2::new(1.0, 5.0)).is_on_edge());
assert!(edge.project_point(Point2::new(0.5, -2.0)).is_on_edge());
assert!(edge.project_point(Point2::new(1.0, 0.0)).is_on_edge());

// These vertices are all projected behind the edge
assert!(edge.project_point(Point2::new(4.000001, 0.0)).is_behind_edge());
assert!(edge.project_point(Point2::new(5.0, -12.0)).is_behind_edge());
source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, CdtEdge<UE>, F, DirectedEdgeTag, InnerTag>

source

pub fn is_constraint_edge(self) -> bool

Returns true if this edge is a constraint edge.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, UndirectedVoronoiEdgeTag, InnerTag>

source

pub fn vertices(&self) -> [VoronoiVertex<'a, V, DE, UE, F>; 2]

Returns the edge’s two vertices.

The vertices are returned in any order.

source

pub fn as_directed(&self) -> DirectedVoronoiEdge<'a, V, DE, UE, F>

Converts this undirected handle into a directed edge handle.

source

pub fn as_delaunay_edge(&self) -> UndirectedEdgeHandle<'a, V, DE, UE, F>

Returns the dual edge of the Delaunay triangulation.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, UndirectedEdgeTag, InnerTag>

source

pub fn vertices(&self) -> [VertexHandle<'a, V, DE, UE, F>; 2]

Returns the edge’s two vertices.

The vertices are returned in any order.

source

pub fn as_directed(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>

Converts this directed edge into an undirected edge handle.

source

pub fn as_voronoi_edge(&self) -> UndirectedVoronoiEdge<'a, V, DE, UE, F>

Returns the dual edge in the Voronoi diagram.

source

pub fn data(&self) -> &UE

Returns a reference to the data associated with this directed edge.

Use Triangulation::undirected_edge_data_mut to modify the edge data.

source

pub fn is_part_of_convex_hull(&self) -> bool

Returns true if the outer face is adjacent to any side of this undirected edge.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, UndirectedEdgeTag, InnerTag>
where V: HasPosition,

source

pub fn positions(&self) -> [Point2<V::Scalar>; 2]

Returns the end positions of this edge.

The positions are returned in any order.

source

pub fn length_2(&self) -> V::Scalar

Returns the squared length of this edge

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, UndirectedEdgeTag, InnerTag>
where V: HasPosition, V::Scalar: Float,

source

pub fn distance_2(&self, query_point: Point2<V::Scalar>) -> V::Scalar

Returns the squared distance of a point to this edge.

source

pub fn nearest_point(&self, query_point: Point2<V::Scalar>) -> Point2<V::Scalar>

Yields the nearest point on this edge.

source

pub fn center(&self) -> Point2<V::Scalar>

Returns the center of this edge.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, CdtEdge<UE>, F, UndirectedEdgeTag, InnerTag>

source

pub fn is_constraint_edge(self) -> bool

Returns true if this edge is a constraint edge.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, FaceTag, InnerTag>

source

pub fn adjacent_edges(&self) -> [DirectedEdgeHandle<'a, V, DE, UE, F>; 3]

Returns the three inner edges adjacent to this face.

e2 e1 e0 face

The edges are returned in counter clockwise order.

source

pub fn adjacent_edge(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>

Returns an edge that is adjacent to this face.

If this face has multiple adjacent edges, any of them is returned.

source

pub fn vertices(&self) -> [VertexHandle<'a, V, DE, UE, F>; 3]

Returns the face’s three vertices.

The vertices are returned in counter clockwise order.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, FaceTag, InnerTag>
where V: HasPosition,

source

pub fn positions(&self) -> [Point2<V::Scalar>; 3]

Returns the positions of the face’s vertices

The positions are returned in counter clockwise order.

source

pub fn area(&self) -> V::Scalar

Returns the triangle’s area.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, FaceTag, InnerTag>
where V: HasPosition, V::Scalar: Float,

source

pub fn distance_2(&self, query_point: Point2<V::Scalar>) -> V::Scalar

Returns the squared distance of a point to this triangle.

The distance of a point inside the triangle is zero.

source

pub fn center(&self) -> Point2<V::Scalar>

Returns the face’s center point.

The center point is the average position of its vertices.

source

pub fn circumcircle(&self) -> (Point2<V::Scalar>, V::Scalar)

Returns the face’s circumcircle center and the squared radius of the circumcircle.

The circumcircle is the unique circle that intersects all three vertices of the face.

source

pub fn circumcenter(&self) -> Point2<V::Scalar>

Returns the face’s circumcenter.

The circumcenter is the center of the circumcircle.

source

pub fn barycentric_interpolation( &self, coordinate: Point2<V::Scalar> ) -> [V::Scalar; 3]

Returns the barycentric coordinates of a point relative to this face.

The returned coordinates will sum up to 1.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, VertexTag, InnerTag>
where V: HasPosition,

source

pub fn position(&self) -> Point2<V::Scalar>

Returns the position of this vertex.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, VertexTag, InnerTag>

source

pub fn out_edges( &self ) -> CircularIterator<'a, V, DE, UE, F, CCWEdgesNextBackFn>

Returns all directed edges going out of this vertex.

The edges are returned in counter clockwise order, beginning at an arbitrary edge.

e6 e5 e4 e3 e2 e1 e0 v

A possible iteration order of v.out_edges()

Note: The returned iterator implements DoubleEndedIterator, allowing traversal in clockwise order.

source

pub fn out_edge(&self) -> Option<DirectedEdgeHandle<'a, V, DE, UE, F>>

Returns an outgoing edge of this vertex.

If the vertex has multiple outgoing edges, any of them is returned.

source

pub fn data(&self) -> &V

Returns the data associated with this vertex.

source

pub fn as_voronoi_face(&self) -> VoronoiFace<'a, V, DE, UE, F>

Returns the voronoi face that corresponds to this vertex of the Delaunay triangulation.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, DirectedEdgeTag, InnerTag>
where V: HasPosition, V::Scalar: Float,

source

pub fn distance_2(&self, query_point: Point2<V::Scalar>) -> V::Scalar

Returns the squared distance of a point to this edge.

source

pub fn nearest_point(&self, query_point: Point2<V::Scalar>) -> Point2<V::Scalar>

Yields the nearest point on this edge.

source

pub fn center(&self) -> Point2<V::Scalar>

Returns the center of this edge

source§

impl<'a, V, DE, UE, F, InnerOuter: InnerOuterMarker> DynamicHandleImpl<'a, V, DE, UE, F, FaceTag, InnerOuter>

source

pub fn data(&self) -> &F

Returns a reference to the data associated with this face.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, FaceTag, PossiblyOuterTag>

source

pub fn is_outer(&self) -> bool

Returns true if this handle refers to the single outer face.

source

pub fn as_inner(&self) -> Option<FaceHandle<'a, InnerTag, V, DE, UE, F>>

Converts this possibly outer face handle into an inner face handle.

Returns None if this handle refers to the outer face.

source

pub fn adjacent_edge(&self) -> Option<DirectedEdgeHandle<'a, V, DE, UE, F>>

Returns an edge that is adjacent to this face.

The returned edge has this face on its left side. Returns None if the triangulation has only one or no vertices.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, VoronoiFaceTag, PossiblyOuterTag>

source

pub fn as_delaunay_vertex(&self) -> VertexHandle<'a, V, DE, UE, F>

Converts this face into its dual vertex of the Delaunay Triangulation.

source

pub fn adjacent_edges( &self ) -> impl DoubleEndedIterator<Item = DirectedVoronoiEdge<'a, V, DE, UE, F>>

Returns an iterator that returns all edges adjacent to this face.

The edges are returned in clockwise order.

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, DirectedVoronoiEdgeTag, InnerTag>

source

pub fn to(&self) -> VoronoiVertex<'a, V, DE, UE, F>

Returns the voronoi edge’s destination.

source

pub fn from(&self) -> VoronoiVertex<'a, V, DE, UE, F>

Returns the voronoi vertex from which this edge originates.

source

pub fn face(&self) -> VoronoiFace<'a, V, DE, UE, F>

Returns the Voronoi face to the left of this Voronoi edge

source

pub fn as_undirected(&self) -> UndirectedVoronoiEdge<'a, V, DE, UE, F>

Converts this directed edge handle into an undirected edge handle.

See also the handles module for more information.

source

pub fn as_delaunay_edge(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>

Returns the directed dual edge of the underlying Delaunay triangulation.

The dual edge is always orthogonal to to this edge.

Shows various inner voronoi edges (blue) and their dual Delaunay edges (orange)

source

pub fn rev(&self) -> Self

Returns this edge with its direction reversed.

source

pub fn next(&self) -> DirectedVoronoiEdge<'a, V, DE, UE, F>

Returns the edge that is connected to this edge in counter clockwise order.

See also prev

source

pub fn prev(&self) -> DirectedVoronoiEdge<'a, V, DE, UE, F>

Returns the edge that is connected to this edge in clockwise order.

See also next

source§

impl<'a, V, DE, UE, F> DynamicHandleImpl<'a, V, DE, UE, F, DirectedVoronoiEdgeTag, InnerTag>
where V: HasPosition,

source

pub fn direction_vector(&self) -> Point2<V::Scalar>

Returns a vector that is parallel to the voronoi edge.

This vector is obtained by rotating the dual Delaunay edge by 90° degree The returned vector is not necessarily normalized.

Trait Implementations§

source§

impl<'a, V, DE, UE, F, Type: Copy, InnerOuter: InnerOuterMarker> Clone for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<'a, V, DE, UE, F, Type: Hash, InnerOuter: InnerOuterMarker> Hash for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>

source§

fn hash<HA: Hasher>(&self, state: &mut HA)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'a, V, DE, UE, F, Type: Ord, InnerOuter: InnerOuterMarker> Ord for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>

source§

fn cmp(&self, other: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl<'a, V, DE, UE, F, Type: PartialEq, InnerOuter: InnerOuterMarker> PartialEq for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<'a, V, DE, UE, F, Type: PartialOrd, InnerOuter: InnerOuterMarker> PartialOrd for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>

source§

fn partial_cmp(&self, other: &Self) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<'a, V, DE, UE, F, Type: Copy, InnerOuter: InnerOuterMarker> Copy for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>

source§

impl<'a, V, DE, UE, F, Type: Eq, InnerOuter: InnerOuterMarker> Eq for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>

Auto Trait Implementations§

§

impl<'a, V, DE, UE, F, Type, InnerOuter> RefUnwindSafe for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>

§

impl<'a, V, DE, UE, F, Type, InnerOuter> Send for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>
where DE: Sync, F: Sync, InnerOuter: Send, Type: Send, UE: Sync, V: Sync,

§

impl<'a, V, DE, UE, F, Type, InnerOuter> Sync for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>
where DE: Sync, F: Sync, InnerOuter: Sync, Type: Sync, UE: Sync, V: Sync,

§

impl<'a, V, DE, UE, F, Type, InnerOuter> Unpin for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>
where InnerOuter: Unpin, Type: Unpin,

§

impl<'a, V, DE, UE, F, Type, InnerOuter> UnwindSafe for DynamicHandleImpl<'a, V, DE, UE, F, Type, InnerOuter>
where DE: RefUnwindSafe, F: RefUnwindSafe, InnerOuter: UnwindSafe, Type: UnwindSafe, UE: RefUnwindSafe, V: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.