GEOS 3.6.2
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 * Last port: algorithm/MinimumDiameter.java r966
17 *
18 **********************************************************************/
19
20#ifndef GEOS_ALGORITHM_MINIMUMDIAMETER_H
21#define GEOS_ALGORITHM_MINIMUMDIAMETER_H
22
23#include <geos/export.h>
24
25// Forward declarations
26namespace geos {
27 namespace geom {
28 class Geometry;
29 class LineSegment;
30 class LineString;
31 class Coordinate;
33 }
34}
35
36
37namespace geos {
38namespace algorithm { // geos::algorithm
39
65class GEOS_DLL MinimumDiameter {
66private:
67 const geom::Geometry* inputGeom;
68 bool isConvex;
69
70 geom::CoordinateSequence* convexHullPts;
71
72 geom::LineSegment* minBaseSeg;
73 geom::Coordinate* minWidthPt;
74 int minPtIndex;
75 double minWidth;
76 void computeMinimumDiameter();
77 void computeWidthConvex(const geom::Geometry* geom);
78
86 void computeConvexRingMinDiameter(const geom::CoordinateSequence *pts);
87
88 unsigned int findMaxPerpDistance(const geom::CoordinateSequence* pts,
89 geom::LineSegment* seg, unsigned int startIndex);
90
91 static unsigned int getNextIndex(const geom::CoordinateSequence* pts,
92 unsigned int index);
93
94 static double computeC(double a, double b, const geom::Coordinate &p);
95
96 static geom::LineSegment computeSegmentForLine(double a, double b, double c);
97
98public:
100
106 MinimumDiameter(const geom::Geometry* newInputGeom);
107
117 MinimumDiameter(const geom::Geometry* newInputGeom,
118 const bool newIsConvex);
119
125 double getLength();
126
133
140
147
158
166
173
174};
175
176} // namespace geos::algorithm
177} // namespace geos
178
179#endif // GEOS_ALGORITHM_MINIMUMDIAMETER_H
180
geom::Geometry * getMinimumRectangle()
geom::Coordinate * getWidthCoordinate()
Gets the geom::Coordinate forming one end of the minimum diameter.
static geom::Geometry * getMinimumRectangle(geom::Geometry *geom)
geom::LineString * getDiameter()
Gets a LineString which is a minimum diameter.
double getLength()
Gets the length of the minimum diameter of the input Geometry.
static geom::Geometry * getMinimumDiameter(geom::Geometry *geom)
geom::LineString * getSupportingSegment()
Gets the segment forming the base of the minimum diameter.
MinimumDiameter(const geom::Geometry *newInputGeom)
Compute a minimum diameter for a giver Geometry.
MinimumDiameter(const geom::Geometry *newInputGeom, const bool newIsConvex)
Compute a minimum diameter for a given Geometry, with a hint if the Geometry is convex (e....
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
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
Definition LineSegment.h:57
Definition LineString.h:70
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
Provides classes for various kinds of spatial indexes.
Definition IndexedNestedRingTester.h:31
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25