Package org.locationtech.jts.algorithm
Class MinimumAreaRectangle
- java.lang.Object
-
- org.locationtech.jts.algorithm.MinimumAreaRectangle
-
public class MinimumAreaRectangle extends Object
Computes the minimum-area rectangle enclosing aGeometry
. Unlike theEnvelope
, the rectangle may not be axis-parallel.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.
In degenerate cases the minimum enclosing geometry may be a
LineString
or aPoint
.The minimum-area enclosing rectangle does not necessarily have the minimum possible width. Use
MinimumDiameter
to compute this.- See Also:
MinimumDiameter
,ConvexHull
-
-
Constructor Summary
Constructors Constructor Description MinimumAreaRectangle(Geometry inputGeom)
Compute a minimum-area rectangle for a givenGeometry
.MinimumAreaRectangle(Geometry inputGeom, boolean isConvex)
Compute a minimum rectangle for aGeometry
, with a hint if the geometry is convex (e.g. a convex Polygon or LinearRing, or a two-point LineString, or a Point).
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Geometry
getMinimumRectangle(Geometry geom)
Gets the minimum-area rectangularPolygon
which encloses the input geometry.
-
-
-
Constructor Detail
-
MinimumAreaRectangle
public MinimumAreaRectangle(Geometry inputGeom)
Compute a minimum-area rectangle for a givenGeometry
.- Parameters:
inputGeom
- a Geometry
-
MinimumAreaRectangle
public MinimumAreaRectangle(Geometry inputGeom, boolean isConvex)
Compute a minimum rectangle for aGeometry
, with a hint if the geometry is convex (e.g. a convex Polygon or LinearRing, or a two-point LineString, or a Point).- Parameters:
inputGeom
- a Geometry which is convexisConvex
-true
if the input geometry is convex
-
-
Method Detail
-
getMinimumRectangle
public static Geometry getMinimumRectangle(Geometry geom)
Gets the minimum-area rectangularPolygon
which encloses the input geometry. If the convex hull of the input is degenerate (a line or point) aLineString
orPoint
is returned.- Parameters:
geom
- the geometry- Returns:
- the minimum rectangle enclosing the geometry
-
-