Trait fenris_geometry::Polygon2d
source · pub trait Polygon2d<T>where
T: Real,{
fn vertices(&self) -> &[Point2<T>];
fn num_edges(&self) -> usize;
fn get_edge(&self, index: usize) -> Option<LineSegment2d<T>>;
fn pseudonormal_on_edge(&self, edge_index: usize, t: T) -> Option<Vector2<T>>;
fn num_vertices(&self) -> usize { ... }
fn for_each_edge(&self, func: impl FnMut(usize, LineSegment2d<T>)) { ... }
fn closest_edge(&self, x: &Point2<T>) -> Option<ClosestEdge<T>> { ... }
fn intersects_segment(&self, segment: &LineSegment2d<T>) -> bool { ... }
fn signed_area(&self) -> T { ... }
fn area(&self) -> T { ... }
fn orientation(&self) -> Orientation { ... }
}
Required Methods§
fn vertices(&self) -> &[Point2<T>]
fn num_edges(&self) -> usize
fn get_edge(&self, index: usize) -> Option<LineSegment2d<T>>
sourcefn pseudonormal_on_edge(&self, edge_index: usize, t: T) -> Option<Vector2<T>>
fn pseudonormal_on_edge(&self, edge_index: usize, t: T) -> Option<Vector2<T>>
Returns the given pseudonormal (angle-weighted normal) given an edge index and a parameter representing a point on edge.
If t == 0, then the average normal of this edge and its predecessor neighbor is returned. If t == 1, then the average normal of this edge and its successor neighbor is returned. Otherwise the normal of the edge is returned.
Provided Methods§
fn num_vertices(&self) -> usize
fn for_each_edge(&self, func: impl FnMut(usize, LineSegment2d<T>))
fn closest_edge(&self, x: &Point2<T>) -> Option<ClosestEdge<T>>
fn intersects_segment(&self, segment: &LineSegment2d<T>) -> bool
sourcefn signed_area(&self) -> T
fn signed_area(&self) -> T
Computes the signed area of the (simple) polygon.
The signed area of a simple polygon is positive if the polygon has a counter-clockwise orientation, or negative if it is oriented clockwise.