GEOS  3.3.3
MinimumDiameter.h
1 /**********************************************************************
2  * $Id: MinimumDiameter.h 2556 2009-06-06 22:22:28Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************/
16 
17 #ifndef GEOS_ALGORITHM_MINIMUMDIAMETER_H
18 #define GEOS_ALGORITHM_MINIMUMDIAMETER_H
19 
20 #include <geos/export.h>
21 
22 // Forward declarations
23 namespace geos {
24  namespace geom {
25  class Geometry;
26  class LineSegment;
27  class LineString;
28  class Coordinate;
29  class CoordinateSequence;
30  }
31 }
32 
33 
34 namespace geos {
35 namespace algorithm { // geos::algorithm
36 
55 class GEOS_DLL MinimumDiameter {
56 private:
57  const geom::Geometry* inputGeom;
58  bool isConvex;
59  geom::LineSegment* minBaseSeg;
60  geom::Coordinate* minWidthPt;
61  int minPtIndex;
62  double minWidth;
63  void computeMinimumDiameter();
64  void computeWidthConvex(const geom::Geometry* geom);
65 
73  void computeConvexRingMinDiameter(const geom::CoordinateSequence *pts);
74 
75  unsigned int findMaxPerpDistance(const geom::CoordinateSequence* pts,
76  geom::LineSegment* seg, unsigned int startIndex);
77 
78  static unsigned int getNextIndex(const geom::CoordinateSequence* pts,
79  unsigned int index);
80 
81 public:
82  ~MinimumDiameter();
83 
89  MinimumDiameter(const geom::Geometry* newInputGeom);
90 
100  MinimumDiameter(const geom::Geometry* newInputGeom,
101  const bool newIsConvex);
102 
108  double getLength();
109 
115  geom::Coordinate* getWidthCoordinate();
116 
122  geom::LineString* getSupportingSegment();
123 
129  geom::LineString* getDiameter();
130 };
131 
132 } // namespace geos::algorithm
133 } // namespace geos
134 
135 #endif // GEOS_ALGORITHM_MINIMUMDIAMETER_H
136 
137 /**********************************************************************
138  * $Log$
139  * Revision 1.1 2006/03/09 16:46:48 strk
140  * geos::geom namespace definition, first pass at headers split
141  *
142  **********************************************************************/
143