00001 /********************************************************************** 00002 * $Id: MinimumDiameter.h 1820 2006-09-06 16:54:23Z mloskot $ 00003 * 00004 * GEOS - Geometry Engine Open Source 00005 * http://geos.refractions.net 00006 * 00007 * Copyright (C) 2005-2006 Refractions Research Inc. 00008 * Copyright (C) 2001-2002 Vivid Solutions Inc. 00009 * 00010 * This is free software; you can redistribute and/or modify it under 00011 * the terms of the GNU Lesser General Public Licence as published 00012 * by the Free Software Foundation. 00013 * See the COPYING file for more information. 00014 * 00015 **********************************************************************/ 00016 00017 #ifndef GEOS_ALGORITHM_MINIMUMDIAMETER_H 00018 #define GEOS_ALGORITHM_MINIMUMDIAMETER_H 00019 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 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 00136 /********************************************************************** 00137 * $Log$ 00138 * Revision 1.1 2006/03/09 16:46:48 strk 00139 * geos::geom namespace definition, first pass at headers split 00140 * 00141 **********************************************************************/ 00142