GEOS
3.4.2
|
00001 /********************************************************************** 00002 * 00003 * GEOS - Geometry Engine Open Source 00004 * http://geos.osgeo.org 00005 * 00006 * Copyright (C) 2005-2006 Refractions Research Inc. 00007 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00008 * 00009 * This is free software; you can redistribute and/or modify it under 00010 * the terms of the GNU Lesser General Public Licence as published 00011 * by the Free Software Foundation. 00012 * See the COPYING file for more information. 00013 * 00014 **********************************************************************/ 00015 00016 #ifndef GEOS_ALGORITHM_MINIMUMDIAMETER_H 00017 #define GEOS_ALGORITHM_MINIMUMDIAMETER_H 00018 00019 #include <geos/export.h> 00020 00021 // Forward declarations 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 { // geos::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 } // namespace geos::algorithm 00132 } // namespace geos 00133 00134 #endif // GEOS_ALGORITHM_MINIMUMDIAMETER_H 00135