Type Alias spade::handles::DirectedEdgeHandle
source · pub type DirectedEdgeHandle<'a, V, DE, UE, F> = DynamicHandleImpl<'a, V, DE, UE, F, DirectedEdgeTag, InnerTag>;
Expand description
Handle to a directed edge of a triangulation.
Use this handle to examine the edge’s surroundings, e.g. its origin and destination vertices or the adjacent face.
§Retrieving neighboring edges:
Use Self::next, Self::prev, Self::rev to access any adjacent edge:
§Retrieving adjacent faces and vertices
Use Self::face, Self::from and Self::to to access the adjacent face and vertices:
See also the handles module.
Aliased Type§
struct DirectedEdgeHandle<'a, V, DE, UE, F> { /* private fields */ }
Implementations§
source§impl<'a, V, DE, UE, F> DirectedEdgeHandle<'a, V, DE, UE, F>
impl<'a, V, DE, UE, F> DirectedEdgeHandle<'a, V, DE, UE, F>
sourcepub fn vertices(&self) -> [VertexHandle<'a, V, DE, UE, F>; 2]
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()
.
sourcepub fn from(&self) -> VertexHandle<'a, V, DE, UE, F>
pub fn from(&self) -> VertexHandle<'a, V, DE, UE, F>
Returns the edge’s origin vertex.
sourcepub fn to(&self) -> VertexHandle<'a, V, DE, UE, F>
pub fn to(&self) -> VertexHandle<'a, V, DE, UE, F>
Returns the edge’s destination vertex.
sourcepub fn opposite_vertex(&self) -> Option<VertexHandle<'a, V, DE, UE, F>>
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.
sourcepub fn next(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>
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.
sourcepub fn prev(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>
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.
sourcepub fn face(&self) -> FaceHandle<'a, PossiblyOuterTag, V, DE, UE, F>
pub fn face(&self) -> FaceHandle<'a, PossiblyOuterTag, V, DE, UE, F>
Returns the face located to the left of this edge.
sourcepub fn cw(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>
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.
sourcepub fn ccw(&self) -> DirectedEdgeHandle<'a, V, DE, UE, F>
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.
sourcepub fn data(&self) -> &'a DE
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.
sourcepub fn as_undirected(self) -> UndirectedEdgeHandle<'a, V, DE, UE, F>
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.
sourcepub fn is_outer_edge(&self) -> bool
pub fn is_outer_edge(&self) -> bool
Returns true
if this edge is adjacent to the outer face.
sourcepub fn is_part_of_convex_hull(&self) -> bool
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.
sourcepub fn as_voronoi_edge(&self) -> DirectedVoronoiEdge<'a, V, DE, UE, F>
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> DirectedEdgeHandle<'a, V, DE, UE, F>where
V: HasPosition,
impl<'a, V, DE, UE, F> DirectedEdgeHandle<'a, V, DE, UE, F>where
V: HasPosition,
sourcepub fn positions(&self) -> [Point2<<V as HasPosition>::Scalar>; 2]
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()
.
sourcepub fn opposite_position(&self) -> Option<Point2<V::Scalar>>
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.
sourcepub fn side_query(&self, query_point: Point2<V::Scalar>) -> LineSideInfo
pub fn side_query(&self, query_point: Point2<V::Scalar>) -> LineSideInfo
Identifies on which side of this edge a point lies.
sourcepub fn project_point(
&self,
query_point: Point2<V::Scalar>
) -> PointProjection<V::Scalar>
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.
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> DirectedEdgeHandle<'a, V, DE, CdtEdge<UE>, F>
impl<'a, V, DE, UE, F> DirectedEdgeHandle<'a, V, DE, CdtEdge<UE>, F>
sourcepub fn is_constraint_edge(self) -> bool
pub fn is_constraint_edge(self) -> bool
Returns true
if this edge is a constraint edge.