00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef GEOS_ALGORITHM_MINIMUMDIAMETER_H
00017 #define GEOS_ALGORITHM_MINIMUMDIAMETER_H
00018
00019 #include <geos/export.h>
00020
00021
00022 namespace geos {
00023 namespace geom {
00024 class Geometry;
00025 class LineSegment;
00026 class LineString;
00027 class Coordinate;
00028 class CoordinateSequence;
00029 }
00030 }
00031
00032
00033 namespace geos {
00034 namespace algorithm {
00035
00054 class GEOS_DLL MinimumDiameter {
00055 private:
00056 const geom::Geometry* inputGeom;
00057 bool isConvex;
00058 geom::LineSegment* minBaseSeg;
00059 geom::Coordinate* minWidthPt;
00060 int minPtIndex;
00061 double minWidth;
00062 void computeMinimumDiameter();
00063 void computeWidthConvex(const geom::Geometry* geom);
00064
00072 void computeConvexRingMinDiameter(const geom::CoordinateSequence *pts);
00073
00074 unsigned int findMaxPerpDistance(const geom::CoordinateSequence* pts,
00075 geom::LineSegment* seg, unsigned int startIndex);
00076
00077 static unsigned int getNextIndex(const geom::CoordinateSequence* pts,
00078 unsigned int index);
00079
00080 public:
00081 ~MinimumDiameter();
00082
00088 MinimumDiameter(const geom::Geometry* newInputGeom);
00089
00099 MinimumDiameter(const geom::Geometry* newInputGeom,
00100 const bool newIsConvex);
00101
00107 double getLength();
00108
00114 geom::Coordinate* getWidthCoordinate();
00115
00121 geom::LineString* getSupportingSegment();
00122
00128 geom::LineString* getDiameter();
00129 };
00130
00131 }
00132 }
00133
00134 #endif // GEOS_ALGORITHM_MINIMUMDIAMETER_H
00135