org.locationtech.jts:jts-core 1.17.0
org.locationtech.jts.algorithm

## Class MinimumBoundingCircle

• ```public class MinimumBoundingCircle
extends Object```
Computes the Minimum Bounding Circle (MBC) for the points in a `Geometry`. The MBC is the smallest circle which covers all the input points (this is also known as the Smallest Enclosing Circle). This is equivalent to computing the Maximum Diameter of the input point set.

The computed circle can be specified in two equivalent ways, both of which are provide as output by this class:

• As a centre point and a radius
• By the set of points defining the circle. Depending on the number of points in the input and their relative positions, this set contains from 0 to 3 points.
• 0 or 1 points indicate an empty or trivial input point arrangement.
• 2 points define the diameter of the minimum bounding circle.
• 3 points define an inscribed triangle of the minimum bounding circle.
The class can also output a `Geometry` which approximates the shape of the Minimum Bounding Circle (although as an approximation it is not guaranteed to cover all the input points.)

The Maximum Diameter of the input point set can be computed as well. The Maximum Diameter is defined by the pair of input points with maximum distance between them. The points of the maximum diameter are two of the extremal points of the Minimum Bounding Circle. They lie on the convex hull of the input. However, that the maximum diameter is not a diameter of the Minimum Bounding Circle in the case where the MBC is defined by an inscribed triangle.

Author:
Martin Davis
`MinimumDiameter`
• ### Constructor Summary

Constructors
Constructor and Description
`MinimumBoundingCircle(Geometry geom)`
Creates a new object for computing the minimum bounding circle for the point set defined by the vertices of the given geometry.
• ### Method Summary

All Methods
Modifier and Type Method and Description
`Coordinate` `getCentre()`
Gets the centre point of the computed Minimum Bounding Circle.
`Geometry` `getCircle()`
Gets a geometry which represents the Minimum Bounding Circle.
`Geometry` `getDiameter()`
Gets a geometry representing the diameter of the computed Minimum Bounding Circle.
`Coordinate[]` `getExtremalPoints()`
Gets the extremal points which define the computed Minimum Bounding Circle.
`Geometry` `getFarthestPoints()`
Deprecated.
use #getMaximumDiameter()
`Geometry` `getMaximumDiameter()`
Gets a geometry representing the maximum diameter of the input.
`double` `getRadius()`
Gets the radius of the computed Minimum Bounding Circle.
• ### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• ### Constructor Detail

• #### MinimumBoundingCircle

`public MinimumBoundingCircle(Geometry geom)`
Creates a new object for computing the minimum bounding circle for the point set defined by the vertices of the given geometry.
Parameters:
`geom` - the geometry to use to obtain the point set
• ### Method Detail

• #### getCircle

`public Geometry getCircle()`
Gets a geometry which represents the Minimum Bounding Circle. If the input is degenerate (empty or a single unique point), this method will return an empty geometry or a single Point geometry. Otherwise, a Polygon will be returned which approximates the Minimum Bounding Circle. (Note that because the computed polygon is only an approximation, it may not precisely contain all the input points.)
Returns:
a Geometry representing the Minimum Bounding Circle.
• #### getMaximumDiameter

`public Geometry getMaximumDiameter()`
Gets a geometry representing the maximum diameter of the input. The maximum diameter is the longest line segment between any two points of the input.

The points are two of the extremal points of the Minimum Bounding Circle. They lie on the convex hull of the input.

Returns:
a LineString between the two farthest points of the input
• #### getFarthestPoints

`public Geometry getFarthestPoints()`
Deprecated. use #getMaximumDiameter()
Gets a geometry representing a line between the two farthest points in the input.

The points are two of the extremal points of the Minimum Bounding Circle. They lie on the convex hull of the input.

Returns:
a LineString between the two farthest points of the input
• #### getDiameter

`public Geometry getDiameter()`
Gets a geometry representing the diameter of the computed Minimum Bounding Circle.
Returns:
the diameter LineString of the Minimum Bounding Circle
• #### getExtremalPoints

`public Coordinate[] getExtremalPoints()`
Gets the extremal points which define the computed Minimum Bounding Circle. There may be zero, one, two or three of these points, depending on the number of points in the input and the geometry of those points.
• 0 or 1 points indicate an empty or trivial input point arrangement.
• 2 points define the diameter of the Minimum Bounding Circle.
• 3 points define an inscribed triangle of which the Minimum Bounding Circle is the circumcircle. The longest chords of the circle are the line segments [0-1] and [1-2]
Returns:
the points defining the Minimum Bounding Circle
• #### getCentre

`public Coordinate getCentre()`
Gets the centre point of the computed Minimum Bounding Circle.
Returns:
the centre point of the Minimum Bounding Circle
`public double getRadius()`