spade::handles

Type Alias FaceHandle

Source
pub type FaceHandle<'a, InnerOuter, V, DE, UE, F> = DynamicHandleImpl<'a, V, DE, UE, F, FaceTag, InnerOuter>;
Expand description

Handle to a face of a triangulation.

Depending on the type parameter, the handle can refer to the outer face:

  • FaceHandle<'a, PossiblyOuterTag, ...>: The face may refer to the single outer face.
  • FaceHandle<'a, InnerTag, ...>: The face refers to an inner triangle of the triangulation.
inner outer inner outer inner outer

FaceHandle<'a, InnerTag, ...> implements some additional methods that require it to be an inner face - e.g. Self::vertices will return an array containing exactly 3 vertices.

Use Self::as_inner to convert from a possibly outer face to an inner face.

§Type parameters

The type parameters refer to the triangulations vertex, directed edge, undirected edge and face type. See Triangulation for more information.

See also the handles module for more general information about handles.

Aliased Type§

struct FaceHandle<'a, InnerOuter, V, DE, UE, F> { /* private fields */ }

Implementations§

Source§

impl<'a, V, DE, UE, F> FaceHandle<'a, InnerTag, V, DE, UE, F>

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 counterclockwise 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 counterclockwise order.

Source§

impl<V, DE, UE, F> FaceHandle<'_, InnerTag, V, DE, UE, F>
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 counterclockwise order.

Source

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

Returns the triangle’s area.

Source§

impl<'a, V, DE, UE, F> FaceHandle<'a, InnerTag, V, DE, UE, F>
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<V, DE, UE, F, InnerOuter: InnerOuterMarker> FaceHandle<'_, InnerOuter, V, DE, UE, F>

Source

pub fn data(&self) -> &F

Returns a reference to the data associated with this face.

Source§

impl<'a, V, DE, UE, F> FaceHandle<'a, PossiblyOuterTag, V, DE, UE, F>

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.

Trait Implementations§

Source§

impl<V, DE, UE, InnerOuter, F> AsRef<F> for FaceHandle<'_, InnerOuter, V, DE, UE, F>
where InnerOuter: InnerOuterMarker,

Source§

fn as_ref(&self) -> &F

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<V, DE, UE, F> Debug for FaceHandle<'_, InnerTag, V, DE, UE, F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<V, DE, UE, F> Debug for FaceHandle<'_, PossiblyOuterTag, V, DE, UE, F>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more