[][src]Trait geo::algorithm::is_convex::IsConvex

pub trait IsConvex {
    pub fn convex_orientation(
        &self,
        allow_collinear: bool,
        specific_orientation: Option<Orientation>
    ) -> Option<Orientation>;
pub fn is_collinear(&self) -> bool; pub fn is_convex(&self) -> bool { ... }
pub fn is_ccw_convex(&self) -> bool { ... }
pub fn is_cw_convex(&self) -> bool { ... }
pub fn is_strictly_convex(&self) -> bool { ... }
pub fn is_strictly_ccw_convex(&self) -> bool { ... }
pub fn is_strictly_cw_convex(&self) -> bool { ... } }

Predicates to test the convexity of a LineString . A closed LineString is said to be convex if it encloses a convex set. It is said to be strictly convex if in addition, no three consecutive vertices are collinear. It is collinear if all the vertices lie on the same line.

Remarks

  • Collinearity does not require that the LineString be closed, but the rest of the predicates do.

  • This definition is closely related to the notion of convexity of polygons. In particular, a Polygon is convex, if and only if its exterior is convex, and interiors is empty.

  • The ConvexHull algorithm always returns a strictly convex LineString unless the input is empty or collinear. The graham_hull algorithm provides an option to include collinear points, producing a (possibly non-strict) convex LineString.

Edge Cases

  • the convexity, and collinearity of an empty LineString is unspecified and must not be relied upon.

  • A closed LineString with at most three coordinates (including the possibly repeated first coordinate) is both convex and collinear. However, the strict convexity is unspecified and must not be relied upon.

Required methods

pub fn convex_orientation(
    &self,
    allow_collinear: bool,
    specific_orientation: Option<Orientation>
) -> Option<Orientation>
[src]

Test and get the orientation if the shape is convex. Tests for strict convexity if allow_collinear, and only accepts a specific orientation if provided.

The return value is None if either:

  1. the shape is not convex

  2. the shape is not strictly convex, and allow_collinear is false

  3. an orientation is specified, and some three consecutive vertices where neither collinear, nor in the specified orientation.

In all other cases, the return value is the orientation of the shape, or Orientation::Collinear if all the vertices are on the same line.

Note. This predicate is not equivalent to is_collinear as this requires that the input is closed.

pub fn is_collinear(&self) -> bool[src]

Test if the shape lies on a line.

Loading content...

Provided methods

pub fn is_convex(&self) -> bool[src]

Test if the shape is convex.

pub fn is_ccw_convex(&self) -> bool[src]

Test if the shape is convex, and oriented counter-clockwise.

pub fn is_cw_convex(&self) -> bool[src]

Test if the shape is convex, and oriented clockwise.

pub fn is_strictly_convex(&self) -> bool[src]

Test if the shape is strictly convex.

pub fn is_strictly_ccw_convex(&self) -> bool[src]

Test if the shape is strictly convex, and oriented counter-clockwise.

pub fn is_strictly_cw_convex(&self) -> bool[src]

Test if the shape is strictly convex, and oriented clockwise.

Loading content...

Implementors

impl<T: HasKernel> IsConvex for LineString<T>[src]

Loading content...