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