Skip to main content

Module is_convex

Module is_convex 

Source
Expand description

is_convex(&g) -> bool.

Mirrors boost::geometry::is_convex(g) from boost/geometry/algorithms/is_convex.hpp. A ring is convex iff every consecutive cross-product ((b − a) × (c − b)) has the same sign (zero allowed — collinear interior vertices don’t disqualify). A polygon is convex iff its outer ring is convex AND it has no interior rings.

This is Cartesian-only: the cross-product predicate is the same in every Cartesian coordinate system, and spherical / geographic convexity is a different algorithm not yet in Boost, so no strategy layer is needed — Boost itself ships is_convex as a plain free function.

Functions§

is_convex
True iff g is convex.