GEOS 3.6.2
ConvexHull.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2011 Sandro Santilli <strk@keybit.net>
7 * Copyright (C) 2005-2006 Refractions Research Inc.
8 * Copyright (C) 2001-2002 Vivid Solutions Inc.
9 *
10 * This is free software; you can redistribute and/or modify it under
11 * the terms of the GNU Lesser General Public Licence as published
12 * by the Free Software Foundation.
13 * See the COPYING file for more information.
14 *
15 **********************************************************************
16 *
17 * Last port: algorithm/ConvexHull.java r407 (JTS-1.12+)
18 *
19 **********************************************************************/
20
21#ifndef GEOS_ALGORITHM_CONVEXHULL_H
22#define GEOS_ALGORITHM_CONVEXHULL_H
23
24#include <geos/export.h>
25#include <vector>
26
27// FIXME: avoid using Cordinate:: typedefs to avoid full include
28#include <geos/geom/Coordinate.h>
29
30#ifdef _MSC_VER
31#pragma warning(push)
32#pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
33#endif
34
35// Forward declarations
36namespace geos {
37 namespace geom {
38 class Geometry;
39 class GeometryFactory;
41 }
42}
43
44namespace geos {
45namespace algorithm { // geos::algorithm
46
58class GEOS_DLL ConvexHull {
59private:
60 const geom::GeometryFactory *geomFactory;
62
63 void extractCoordinates(const geom::Geometry *geom);
64
70
71 void computeOctPts(const geom::Coordinate::ConstVect &src,
73
74 bool computeOctRing(const geom::Coordinate::ConstVect &src,
76
101 void reduce(geom::Coordinate::ConstVect &pts);
102
104 void padArray3(geom::Coordinate::ConstVect &pts);
105
107 void preSort(geom::Coordinate::ConstVect &pts);
108
126 int polarCompare(const geom::Coordinate &o,
127 const geom::Coordinate &p, const geom::Coordinate &q);
128
129 void grahamScan(const geom::Coordinate::ConstVect &c,
131
141 geom::Geometry* lineOrPolygon(const geom::Coordinate::ConstVect &vertices);
142
147 void cleanRing(const geom::Coordinate::ConstVect &input,
149
154 bool isBetween(const geom::Coordinate& c1, const geom::Coordinate& c2, const geom::Coordinate& c3);
155
156public:
157
161 ConvexHull(const geom::Geometry *newGeometry);
162
163
164 ~ConvexHull();
165
179};
180
181} // namespace geos::algorithm
182} // namespace geos
183
184#ifdef _MSC_VER
185#pragma warning(pop)
186#endif
187
188#ifdef GEOS_INLINE
189# include "geos/algorithm/ConvexHull.inl"
190#endif
191
192#endif // GEOS_ALGORITHM_CONVEXHULL_H
geom::Geometry * getConvexHull()
ConvexHull(const geom::Geometry *newGeometry)
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:59
Coordinate is the lightweight class used to store coordinates.
Definition Coordinate.h:60
std::vector< const Coordinate * > ConstVect
A vector of const Coordinate pointers.
Definition Coordinate.h:71
Supplies a set of utility methods for building Geometry objects from CoordinateSequence or other Geom...
Definition GeometryFactory.h:67
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:33
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25