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 Polygoncombine(Polygon base, Polygon target)Merge the coordinates of the two polygons.static intCompareOnX(Polygon polygon1, Polygon polygon2)Compare two polygons based on their X coordinates.static intCompareOnY(Polygon polygon1, Polygon polygon2)Compare two polygons based on their Y coordinates.static PointgetCentroid(List<Point> vertices)Get the central coordinates (centroid) of a list of Points.static PolygongetFrom(List<List<Double>> polygon)Create a Polygon from a list of a list of floats.static DoublegetMaxXCoordinate(Polygon polygon)static DoublegetMaxYCoordinate(Polygon polygon)static MinMaxgetMinMaxX(List<Point> vertices)Get the maximum and minimum X coordinates in a given list of Points.static MinMaxgetMinMaxY(List<Point> vertices)Get the maximum and minimum Y coordinates in a given list of Points.static DoublegetMinXCoordinate(Polygon polygon)static DoublegetMinYCoordinate(Polygon polygon)static booleanisPointInPolygonY(Point centroid, Polygon polygon)Determine if a Point is within a Polygon's Y axis.static booleanisPointInY(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.
-
-