20 #ifndef GEOS_ALGORITHM_MINIMUMDIAMETER_H
21 #define GEOS_ALGORITHM_MINIMUMDIAMETER_H
23 #include <geos/geom/Coordinate.h>
24 #include <geos/geom/LineSegment.h>
27 #include <geos/export.h>
34 class CoordinateSequence;
63 class GEOS_DLL MinimumDiameter {
65 const geom::Geometry* inputGeom;
68 std::unique_ptr<geom::CoordinateSequence> convexHullPts;
70 geom::LineSegment minBaseSeg;
71 geom::Coordinate minWidthPt;
74 void computeMinimumDiameter();
75 void computeWidthConvex(
const geom::Geometry* geom);
84 void computeConvexRingMinDiameter(
const geom::CoordinateSequence* pts);
86 unsigned int findMaxPerpDistance(
const geom::CoordinateSequence* pts,
87 const geom::LineSegment* seg,
unsigned int startIndex);
89 static unsigned int getNextIndex(
const geom::CoordinateSequence* pts,
92 static double computeC(
double a,
double b,
const geom::Coordinate& p);
94 static geom::LineSegment computeSegmentForLine(
double a,
double b,
double c);
97 ~MinimumDiameter() =
default;
104 MinimumDiameter(
const geom::Geometry* newInputGeom);
115 MinimumDiameter(
const geom::Geometry* newInputGeom,
116 const bool newIsConvex);
130 const geom::Coordinate& getWidthCoordinate();
137 std::unique_ptr<geom::LineString> getSupportingSegment();
144 std::unique_ptr<geom::LineString> getDiameter();
157 std::unique_ptr<geom::Geometry> getMinimumRectangle();
165 static std::unique_ptr<geom::Geometry> getMinimumRectangle(geom::Geometry* geom);
172 static std::unique_ptr<geom::Geometry> getMinimumDiameter(geom::Geometry* geom);
179 #endif // GEOS_ALGORITHM_MINIMUMDIAMETER_H