ExactMaxInscribedCircle.h
/**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (c) 2020 Martin Davis
* Copyright (C) 2020 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/construct/ExactMaxInscribedCircle.java
* https://github.com/locationtech/jts/commit/8d5ced1b784d232e1eecf5df4b71873e8822336a
*
**********************************************************************/
#pragma once
#include <geos/geom/Coordinate.h>
#include <geos/geom/LineSegment.h>
#include <array>
// #include <queue>
namespace geos {
namespace geom {
class CoordinateSequence;
class Geometry;
class Polygon;
}
}
namespace geos {
namespace algorithm { // geos::algorithm
namespace construct { // geos::algorithm::construct
class GEOS_DLL ExactMaxInscribedCircle {
using CoordinateSequence = geos::geom::CoordinateSequence;
using CoordinateXY = geos::geom::CoordinateXY;
using LineSegment = geos::geom::LineSegment;
using Polygon = geos::geom::Polygon;
public:
ExactMaxInscribedCircle();
static bool isSupported(const geom::Geometry* geom);
static std::pair<CoordinateXY, CoordinateXY> computeRadius(const Polygon* polygon);
private:
static bool isTriangle(const Polygon* polygon);
static bool isQuadrilateral(const Polygon* polygon);
static std::pair<CoordinateXY, CoordinateXY> computeTriangle(const CoordinateSequence* ring);
static std::pair<CoordinateXY, CoordinateXY> computeConvexQuadrilateral(const CoordinateSequence* ring);
static std::array<LineSegment, 4> computeBisectors(const CoordinateSequence* ptsCW,
double diameter);
static CoordinateXY nearestEdgePt(const CoordinateSequence* ring,
const CoordinateXY& pt);
static LineSegment computeConvexBisector(const CoordinateSequence* pts,
std::size_t index, double len);
static bool isConvex(const Polygon* polygon);
static bool isConvex(const CoordinateSequence* ring);
static bool isConcave(const CoordinateXY& p0,
const CoordinateXY& p1,
const CoordinateXY& p2);
static bool isPointInConvexRing(const CoordinateSequence* ringCW,
const CoordinateXY& p);
};
} // geos::algorithm::construct
} // geos::algorithm
} // geos
geos::algorithm::construct::ExactMaxInscribedCircle::isSupported
static bool isSupported(const geom::Geometry *geom)
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition CoordinateSequence.h:56
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:196
geos::geom::LineSegment
Definition LineSegment.h:61
geos::geom::Polygon
Represents a linear polygon, which may include holes.
Definition Polygon.h:61
geos::algorithm
Contains classes and interfaces implementing fundamental computational geometry algorithms.
Definition Angle.h:32
geos::geom
Definition Angle.h:26
geos::index
Provides classes for various kinds of spatial indexes.
Definition CleanCoverage.h:39
geos
Basic namespace for all GEOS functionalities.
Definition geos.h:38