GEOS  3.13.0dev
Public Member Functions | Static Public Member Functions | List of all members
geos::algorithm::MinimumDiameter Class Reference

Computes the minimum diameter of a geom::Geometry. More...

#include <MinimumDiameter.h>

Public Member Functions

 MinimumDiameter (const geom::Geometry *newInputGeom)
 Compute a minimum diameter for a given Geometry. More...
 
 MinimumDiameter (const geom::Geometry *newInputGeom, const bool newIsConvex)
 Compute a minimum diameter for a given Geometry, with a hint if the Geometry is convex (e.g. a convex Polygon or LinearRing, or a two-point LineString, or a Point). More...
 
double getLength ()
 Gets the length of the minimum diameter of the input Geometry. More...
 
const geom::CoordinategetWidthCoordinate ()
 Gets the geom::Coordinate forming one end of the minimum diameter. More...
 
std::unique_ptr< geom::LineStringgetSupportingSegment ()
 Gets the segment forming the base of the minimum diameter. More...
 
std::unique_ptr< geom::LineStringgetDiameter ()
 Gets a LineString which is a minimum diameter. More...
 
std::unique_ptr< geom::GeometrygetMinimumRectangle ()
 Gets the rectangular Polygon which encloses the input geometry and is based on the minimum diameter supporting segment. More...
 

Static Public Member Functions

static std::unique_ptr< geom::GeometrygetMinimumRectangle (geom::Geometry *geom)
 Gets the minimum rectangle enclosing a geometry. More...
 
static std::unique_ptr< geom::GeometrygetMinimumDiameter (geom::Geometry *geom)
 Gets the length of the minimum diameter enclosing a geometry. More...
 

Detailed Description

Computes the minimum diameter of a geom::Geometry.

The minimum diameter is defined to be the width of the smallest band that contains the geometry, where a band is a strip of the plane defined by two parallel lines. This can be thought of as the smallest hole that the geometry can be moved through, with a single rotation.

The first step in the algorithm is computing the convex hull of the Geometry. If the input Geometry is known to be convex, a hint can be supplied to avoid this computation.

This class can also be used to compute a line segment representing the minimum diameter, the supporting line segment of the minimum diameter, and a minimum-width rectangle of the input geometry. This rectangle will have width equal to the minimum diameter, and have one side parallel to the supporting segment.

In degenerate cases the rectangle may be a LineString or a Point. (Note that this may not be the enclosing rectangle with minimum area; use MinimumAreaRectangle to compute this.)

See also
ConvexHull
MinimumAreaRectangle

Constructor & Destructor Documentation

◆ MinimumDiameter() [1/2]

geos::algorithm::MinimumDiameter::MinimumDiameter ( const geom::Geometry newInputGeom)

Compute a minimum diameter for a given Geometry.

Parameters
newInputGeoma Geometry

◆ MinimumDiameter() [2/2]

geos::algorithm::MinimumDiameter::MinimumDiameter ( const geom::Geometry newInputGeom,
const bool  newIsConvex 
)

Compute a minimum diameter for a given Geometry, with a hint if the Geometry is convex (e.g. a convex Polygon or LinearRing, or a two-point LineString, or a Point).

Parameters
newInputGeoma Geometry which is convex
newIsConvextrue if the input geometry is convex

Member Function Documentation

◆ getDiameter()

std::unique_ptr<geom::LineString> geos::algorithm::MinimumDiameter::getDiameter ( )

Gets a LineString which is a minimum diameter.

Returns
a LineString which is a minimum diameter

◆ getLength()

double geos::algorithm::MinimumDiameter::getLength ( )

Gets the length of the minimum diameter of the input Geometry.

Returns
the length of the minimum diameter

◆ getMinimumDiameter()

static std::unique_ptr<geom::Geometry> geos::algorithm::MinimumDiameter::getMinimumDiameter ( geom::Geometry geom)
static

Gets the length of the minimum diameter enclosing a geometry.

Parameters
geomthe geometry
Returns
the length of the minimum diameter of the geometry

◆ getMinimumRectangle() [1/2]

std::unique_ptr<geom::Geometry> geos::algorithm::MinimumDiameter::getMinimumRectangle ( )

Gets the rectangular Polygon which encloses the input geometry and is based on the minimum diameter supporting segment.

The rectangle has width equal to the minimum diameter, and a longer length. If the convex hill of the input is degenerate (a line or point) a LineString or Point is returned. This is not necessarily the rectangle with minimum area. Use MinimumAreaRectangle to compute this.

Returns
the the minimum-width rectangle enclosing the geometry
See also
MinimumAreaRectangle

◆ getMinimumRectangle() [2/2]

static std::unique_ptr<geom::Geometry> geos::algorithm::MinimumDiameter::getMinimumRectangle ( geom::Geometry geom)
static

Gets the minimum rectangle enclosing a geometry.

Parameters
geomthe geometry
Returns
a rectangle enclosing the input (or a line or point if degenerate)
See also
MinimumAreaRectangle

◆ getSupportingSegment()

std::unique_ptr<geom::LineString> geos::algorithm::MinimumDiameter::getSupportingSegment ( )

Gets the segment forming the base of the minimum diameter.

Returns
the segment forming the base of the minimum diameter

◆ getWidthCoordinate()

const geom::Coordinate& geos::algorithm::MinimumDiameter::getWidthCoordinate ( )

Gets the geom::Coordinate forming one end of the minimum diameter.

Returns
a coordinate forming one end of the minimum diameter

The documentation for this class was generated from the following file: