Package com.mindee.geometry
Class PolygonUtils
- java.lang.Object
-
- com.mindee.geometry.PolygonUtils
-
public final class PolygonUtils extends Object
Methods for working with Polygons.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Polygon
combine(Polygon base, Polygon target)
Merge the coordinates of the two polygons.static int
CompareOnX(Polygon polygon1, Polygon polygon2)
Compare two polygons based on their X coordinates.static int
CompareOnY(Polygon polygon1, Polygon polygon2)
Compare two polygons based on their Y coordinates.static Point
getCentroid(List<Point> vertices)
Get the central coordinates (centroid) of a list of Points.static Polygon
getFrom(List<List<Double>> polygon)
Create a Polygon from a list of a list of floats.static Double
getMaxXCoordinate(Polygon polygon)
static Double
getMaxYCoordinate(Polygon polygon)
static MinMax
getMinMaxX(List<Point> vertices)
Get the maximum and minimum X coordinates in a given list of Points.static MinMax
getMinMaxY(List<Point> vertices)
Get the maximum and minimum Y coordinates in a given list of Points.static Double
getMinXCoordinate(Polygon polygon)
static Double
getMinYCoordinate(Polygon polygon)
static boolean
isPointInPolygonY(Point centroid, Polygon polygon)
Determine if a Point is within a Polygon's Y axis.static boolean
isPointInY(Point centroid, Double yMin, Double yMax)
Determine if a Point is within two Y coordinates.
-
-
-
Method Detail
-
getFrom
public static Polygon getFrom(List<List<Double>> polygon)
Create a Polygon from a list of a list of floats.
-
getCentroid
public static Point getCentroid(List<Point> vertices)
Get the central coordinates (centroid) of a list of Points.
-
CompareOnY
public static int CompareOnY(Polygon polygon1, Polygon polygon2)
Compare two polygons based on their Y coordinates. Useful for sorting lists.
-
CompareOnX
public static int CompareOnX(Polygon polygon1, Polygon polygon2)
Compare two polygons based on their X coordinates. Useful for sorting lists.
-
getMinMaxY
public static MinMax getMinMaxY(List<Point> vertices)
Get the maximum and minimum Y coordinates in a given list of Points.
-
getMinMaxX
public static MinMax getMinMaxX(List<Point> vertices)
Get the maximum and minimum X coordinates in a given list of Points.
-
isPointInY
public static boolean isPointInY(Point centroid, Double yMin, Double yMax)
Determine if a Point is within two Y coordinates.
-
isPointInPolygonY
public static boolean isPointInPolygonY(Point centroid, Polygon polygon)
Determine if a Point is within a Polygon's Y axis.
-
-