MinimumBoundingCircle.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2019 Paul Ramsey <pramsey@cleverelephant.ca>
*
* This is free software; you can redistribute and/or modify it under
* the terms of the GNU Lesser General Public Licence as published
* by the Free Software Foundation.
* See the COPYING file for more information.
*
**********************************************************************
*
* Last port: algorithm/MinimumBoundingCircle.java 2019-01-23
*
**********************************************************************/
#pragma once
#include <geos/export.h>
#include <geos/geom/Coordinate.h>
#include <geos/geom/CoordinateSequence.h>
#include <geos/geom/Geometry.h>
#include <geos/geom/Point.h>
#include <geos/geom/Triangle.h>
#include <vector>
// Forward declarations
// namespace geos {
// namespace geom {
// class GeometryCollection;
// }
// }
namespace geos {
namespace algorithm { // geos::algorithm
class GEOS_DLL MinimumBoundingCircle {
private:
// member variables
const geom::Geometry* input;
std::vector<geom::CoordinateXY> extremalPts;
geom::CoordinateXY centre;
double radius;
void computeCentre();
void compute();
void computeCirclePoints();
geom::CoordinateXY lowestPoint(std::vector<geom::CoordinateXY>& pts);
geom::CoordinateXY pointWitMinAngleWithX(std::vector<geom::CoordinateXY>& pts, geom::CoordinateXY& P);
geom::CoordinateXY pointWithMinAngleWithSegment(std::vector<geom::CoordinateXY>& pts,
geom::CoordinateXY& P, geom::CoordinateXY& Q);
std::vector<geom::CoordinateXY> farthestPoints(std::vector<geom::CoordinateXY>& pts);
public:
MinimumBoundingCircle(const geom::Geometry* geom):
input(nullptr),
radius(0.0)
{
input = geom;
centre.setNull();
}
~MinimumBoundingCircle() {};
std::unique_ptr<geom::Geometry> getCircle();
std::unique_ptr<geom::Geometry> getMaximumDiameter();
std::unique_ptr<geom::Geometry> getDiameter();
std::vector<geom::CoordinateXY> getExtremalPoints();
geom::CoordinateXY getCentre();
double getRadius();
};
} // namespace geos::algorithm
} // namespace geos
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38