public class MinimumDiameter extends Object
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:
MinimumAreaRectangle
to compute this.)
ConvexHull
,
MinimumAreaRectangle
Constructor and Description |
---|
MinimumDiameter(Geometry inputGeom)
Compute a minimum diameter for a given
Geometry . |
MinimumDiameter(Geometry inputGeom,
boolean isConvex)
Compute a minimum diameter for a giver
Geometry ,
with a hint if
the Geometry is convex
(e.g. |
Modifier and Type | Method and Description |
---|---|
LineString |
getDiameter()
Gets a
LineString which is a minimum diameter |
double |
getLength()
Gets the length of the minimum diameter of the input Geometry
|
static Geometry |
getMinimumDiameter(Geometry geom)
Gets the length of the minimum diameter enclosing a geometry
|
Geometry |
getMinimumRectangle()
Gets the rectangular
Polygon which encloses the input geometry
and is based on the minimum diameter supporting segment. |
static Geometry |
getMinimumRectangle(Geometry geom)
Gets the minimum-width rectangular
Polygon which encloses the input geometry
and is based along the supporting segment. |
LineString |
getSupportingSegment()
Gets the segment forming the base of the minimum diameter
|
Coordinate |
getWidthCoordinate()
Gets the
Coordinate forming one end of the minimum diameter |
public MinimumDiameter(Geometry inputGeom)
Geometry
.inputGeom
- a Geometrypublic MinimumDiameter(Geometry inputGeom, boolean isConvex)
Geometry
,
with a hint if
the Geometry is convex
(e.g. a convex Polygon or LinearRing,
or a two-point LineString, or a Point).inputGeom
- a Geometry which is convexisConvex
- true
if the input geometry is convexpublic static Geometry getMinimumRectangle(Geometry geom)
Polygon
which encloses the input geometry
and is based along the supporting segment.
The rectangle has width equal to the minimum diameter,
and a longer length.
If the convex hull 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.
geom
- the geometryMinimumAreaRectangle
public static Geometry getMinimumDiameter(Geometry geom)
geom
- the geometrypublic double getLength()
public Coordinate getWidthCoordinate()
Coordinate
forming one end of the minimum diameterpublic LineString getSupportingSegment()
public LineString getDiameter()
LineString
which is a minimum diameterLineString
which is a minimum diameterpublic Geometry getMinimumRectangle()
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 hull of the input is degenerate (a line or point)
a LineString
or Point
is returned.
This is not necessarily the enclosing rectangle with minimum area.
MinimumAreaRectangle
Copyright © 2024. All rights reserved.