Package org.locationtech.jts.algorithm
Class InteriorPointArea
java.lang.Object
org.locationtech.jts.algorithm.InteriorPointArea
Computes a point in the interior of an areal geometry.
Algorithm
- Find a Y value which is close to the centre of the geometry's vertical extent but is different to any of it's Y ordinates.
- Create a horizontal bisector line using the Y value and the geometry's horizontal extent
- Find the intersection between the geometry and the horizontal bisector line. The intersection is a collection of lines and points.
- Pick the midpoint of the largest intersection geometry
KNOWN BUGS
- If a fixed precision model is used, in some cases this method may return a point which does not lie in the interior.
- Version:
- 1.7
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classFinds a safe bisector Y ordinate by projecting to the Y axis and finding the Y-ordinate interval which contains the centre of the Y extent. -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new interior point finder for an areal geometry. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidTests the interior vertices (if any) defined by an areal Geometry for the best inside point.private voidaddPolygon(Geometry geometry) Finds an interior point of a Polygon.private static doubleavg(double a, double b) static CoordinateReturns the centre point of the envelope.Gets the computed interior point.protected LineStringhorizontalBisector(Geometry geometry) private GeometrywidestGeometry(Geometry geometry) private Geometry
-
Field Details
-
factory
-
interiorPoint
-
maxWidth
private double maxWidth
-
-
Constructor Details
-
InteriorPointArea
Creates a new interior point finder for an areal geometry.- Parameters:
g- an areal geometry
-
-
Method Details
-
avg
private static double avg(double a, double b) -
getInteriorPoint
Gets the computed interior point.- Returns:
- the coordinate of an interior point
-
add
Tests the interior vertices (if any) defined by an areal Geometry for the best inside point. If a component Geometry is not of dimension 2 it is not tested.- Parameters:
geom- the geometry to add
-
addPolygon
Finds an interior point of a Polygon.- Parameters:
geometry- the geometry to analyze
-
widestGeometry
-
widestGeometry
-
horizontalBisector
-
centre
Returns the centre point of the envelope.- Parameters:
envelope- the envelope to analyze- Returns:
- the centre of the envelope
-