GEOS 3.4.2

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

- File List

MinimumDiameter.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2005-2006 Refractions Research Inc.
7 * Copyright (C) 2001-2002 Vivid Solutions Inc.
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 **********************************************************************/
15
16 #ifndef GEOS_ALGORITHM_MINIMUMDIAMETER_H
17 #define GEOS_ALGORITHM_MINIMUMDIAMETER_H
18
19 #include <geos/export.h>
20
21 // Forward declarations
22 namespace geos {
23 namespace geom {
24 class Geometry;
25 class LineSegment;
26 class LineString;
27 class Coordinate;
28 class CoordinateSequence;
29 }
30 }
31
32
33 namespace geos {
34 namespace algorithm { // geos::algorithm
35
54 class GEOS_DLL MinimumDiameter {
55 private:
56 const geom::Geometry* inputGeom;
57 bool isConvex;
58 geom::LineSegment* minBaseSeg;
59 geom::Coordinate* minWidthPt;
60 int minPtIndex;
61 double minWidth;
62 void computeMinimumDiameter();
63 void computeWidthConvex(const geom::Geometry* geom);
64
72 void computeConvexRingMinDiameter(const geom::CoordinateSequence *pts);
73
74 unsigned int findMaxPerpDistance(const geom::CoordinateSequence* pts,
75 geom::LineSegment* seg, unsigned int startIndex);
76
77 static unsigned int getNextIndex(const geom::CoordinateSequence* pts,
78 unsigned int index);
79
80 public:
81 ~MinimumDiameter();
82
88 MinimumDiameter(const geom::Geometry* newInputGeom);
89
99 MinimumDiameter(const geom::Geometry* newInputGeom,
100 const bool newIsConvex);
101
107 double getLength();
108
114 geom::Coordinate* getWidthCoordinate();
115
121 geom::LineString* getSupportingSegment();
122
128 geom::LineString* getDiameter();
129 };
130
131 } // namespace geos::algorithm
132 } // namespace geos
133
134 #endif // GEOS_ALGORITHM_MINIMUMDIAMETER_H
135