|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Rotating calipers metrics for convex polygons. More...
#include <geom_algorithms.H>
Classes | |
| struct | DiameterResult |
| struct | WidthResult |
Static Public Member Functions | |
| static DiameterResult | diameter (const Polygon &poly) |
| Compute convex polygon diameter (farthest vertex pair). | |
| static WidthResult | minimum_width (const Polygon &poly) |
| Compute the minimum width of a closed convex polygon. | |
Static Private Member Functions | |
| static Array< Point > | extract_vertices (const Polygon &poly) |
| Extract polygon vertices into an array. | |
| static bool | is_convex (const Array< Point > &verts) |
| Check if a polygon vertex cycle is convex. | |
| static DiameterResult | make_diameter (const Point &a, const Point &b) |
Rotating calipers metrics for convex polygons.
Computes two standard convex-polygon metrics:
Definition at line 1274 of file geom_algorithms.H.
|
inlinestatic |
Compute convex polygon diameter (farthest vertex pair).
| poly | Closed convex polygon. |
| domain_error | if the polygon is not closed, has < 2 vertices, or is non-convex. |
Definition at line 1339 of file geom_algorithms.H.
References ah_domain_error_if, Aleph::and, Aleph::area_of_parallelogram(), Aleph::RotatingCalipersConvexPolygon::DiameterResult::distance_squared, Aleph::divide_and_conquer_partition_dp(), extract_vertices(), is_convex(), k, and make_diameter().
Referenced by main(), TEST_F(), TEST_F(), and Aleph::visualize_rotating_calipers().
|
inlinestaticprivate |
Extract polygon vertices into an array.
| poly | Input polygon. |
| domain_error | if poly is not closed or has fewer than 2 vertices. |
Definition at line 1302 of file geom_algorithms.H.
References ah_domain_error_if, Aleph::divide_and_conquer_partition_dp(), Aleph::GeomPolygonUtils::extract_vertices(), Aleph::Polygon::is_closed(), and Aleph::Polygon::size().
Referenced by diameter(), and minimum_width().
|
inlinestaticprivate |
Check if a polygon vertex cycle is convex.
Convexity is tested by scanning all consecutive triples and ensuring all non-zero turns have the same sign. Collinear triples are ignored.
| verts | Polygon vertices. |
Definition at line 1320 of file geom_algorithms.H.
References Aleph::divide_and_conquer_partition_dp(), and Aleph::GeomPolygonUtils::is_convex().
Referenced by diameter(), and minimum_width().
|
inlinestaticprivate |
Definition at line 1325 of file geom_algorithms.H.
References Aleph::Point::distance_squared_to().
Referenced by diameter().
|
inlinestatic |
Compute the minimum width of a closed convex polygon.
The width for an edge is the maximum perpendicular distance from vertices to the edge line; the minimum width is the minimum of these edge widths.
| poly | Closed convex polygon. |
| domain_error | if the polygon is not closed, has < 2 vertices, or is non-convex. |
Definition at line 1394 of file geom_algorithms.H.
References ah_domain_error_if, Aleph::and, Aleph::area_of_parallelogram(), Aleph::divide_and_conquer_partition_dp(), extract_vertices(), initialized, is_convex(), and k.
Referenced by main(), TEST_F(), and Aleph::visualize_rotating_calipers().