GEOS
3.9.1dev
|
Computes the convex hull of a Geometry. More...
#include <ConvexHull.h>
Public Member Functions | |
ConvexHull (const geom::Geometry *newGeometry) | |
~ConvexHull () | |
std::unique_ptr< geom::Geometry > | getConvexHull () |
Private Attributes | |
const geom::GeometryFactory * | geomFactory |
geom::Coordinate::ConstVect | inputPts |
Computes the convex hull of a Geometry.
The convex hull is the smallest convex Geometry that contains all the points in the input Geometry.
Uses the Graham Scan algorithm.
Last port: algorithm/ConvexHull.java rev. 1.26 (JTS-1.7)
Definition at line 59 of file ConvexHull.h.
geos::algorithm::ConvexHull::ConvexHull | ( | const geom::Geometry * | newGeometry | ) |
Create a new convex hull construction for the input Geometry.
geos::algorithm::ConvexHull::~ConvexHull | ( | ) |
|
private |
Write in 'cleaned' a version of 'input' with collinear vertexes removed.
|
private |
|
private |
|
private |
std::unique_ptr<geom::Geometry> geos::algorithm::ConvexHull::getConvexHull | ( | ) |
Returns a Geometry that represents the convex hull of the input geometry. The returned geometry contains the minimal number of points needed to represent the convex hull. In particular, no more than two consecutive points will be collinear.
|
private |
|
private |
|
private |
vertices | the vertices of a linear ring, which may or may not be flattened (i.e. vertices collinear) |
|
private |
parameter will be modified
|
private |
Given two points p and q compare them with respect to their radial ordering about point o. First checks radial ordering. If points are collinear, the comparison is based on their distance to the origin.
p < q iff
o | the origin |
p | a point |
q | another point |
|
private |
parameter will be modified
|
private |
Uses a heuristic to reduce the number of points scanned to compute the hull. The heuristic is to find a polygon guaranteed to be in (or on) the hull, and eliminate all points inside it. A quadrilateral defined by the extremal points in the four orthogonal directions can be used, but even more inclusive is to use an octilateral defined by the points in the 8 cardinal directions.
Note that even if the method used to determine the polygon vertices is not 100% robust, this does not affect the robustness of the convex hull.
To satisfy the requirements of the Graham Scan algorithm, the resulting array has at least 3 entries.
pts | The vector of const Coordinate pointers to be reduced (to at least 3 elements) |
WARNING: the parameter will be modified
|
private |
Create a CoordinateSequence from the Coordinate::ConstVect This is needed to construct the geometries. Here coordinate copies happen The returned object is newly allocated !NO EXCEPTION SAFE!
|
private |
Definition at line 61 of file ConvexHull.h.
|
private |
Definition at line 62 of file ConvexHull.h.