GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

ConvexHull.h
1 /**********************************************************************
2 * $Id: ConvexHull.h 3255 2011-03-01 17:56:10Z mloskot $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
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 #ifndef GEOS_ALGORITHM_CONVEXHULL_H
18 #define GEOS_ALGORITHM_CONVEXHULL_H
19
20 #include <geos/export.h>
21 #include <vector>
22
23 // FIXME: avoid using Cordinate:: typedefs to avoid full include
24 #include <geos/geom/Coordinate.h>
25
26 #ifdef _MSC_VER
27 #pragma warning(push)
28 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
29 #endif
30
31 // Forward declarations
32 namespace geos {
33 namespace geom {
34 class Geometry;
35 class GeometryFactory;
36 class CoordinateSequence;
37 }
38 }
39
40 namespace geos {
41 namespace algorithm { // geos::algorithm
42
54 class GEOS_DLL ConvexHull {
55 private:
56 const geom::GeometryFactory *geomFactory;
57 geom::Coordinate::ConstVect inputPts;
58
59 void extractCoordinates(const geom::Geometry *geom);
60
65 geom::CoordinateSequence *toCoordinateSequence(geom::Coordinate::ConstVect &cv);
66
67 void computeOctPts(const geom::Coordinate::ConstVect &src,
68 geom::Coordinate::ConstVect &tgt);
69
70 bool computeOctRing(const geom::Coordinate::ConstVect &src,
71 geom::Coordinate::ConstVect &tgt);
72
95 void reduce(geom::Coordinate::ConstVect &pts);
96
97
99 void preSort(geom::Coordinate::ConstVect &pts);
100
118 int polarCompare(const geom::Coordinate &o,
119 const geom::Coordinate &p, const geom::Coordinate &q);
120
121 void grahamScan(const geom::Coordinate::ConstVect &c,
122 geom::Coordinate::ConstVect &ps);
123
133 geom::Geometry* lineOrPolygon(const geom::Coordinate::ConstVect &vertices);
134
139 void cleanRing(const geom::Coordinate::ConstVect &input,
140 geom::Coordinate::ConstVect &cleaned);
141
146 bool isBetween(const geom::Coordinate& c1, const geom::Coordinate& c2, const geom::Coordinate& c3);
147
148 public:
149
153 ConvexHull(const geom::Geometry *newGeometry);
154
155
156 ~ConvexHull();
157
170 geom::Geometry* getConvexHull();
171 };
172
173 } // namespace geos::algorithm
174 } // namespace geos
175
176 #ifdef _MSC_VER
177 #pragma warning(pop)
178 #endif
179
180 #ifdef GEOS_INLINE
181 # include "geos/algorithm/ConvexHull.inl"
182 #endif
183
184 #endif // GEOS_ALGORITHM_CONVEXHULL_H
185
186 /**********************************************************************
187 * $Log$
188 * Revision 1.2 2006/03/24 09:52:41 strk
189 * USE_INLINE => GEOS_INLINE
190 *
191 * Revision 1.1 2006/03/09 16:46:48 strk
192 * geos::geom namespace definition, first pass at headers split
193 *
194 **********************************************************************/
195