Package adams.gui.visualization.image
Class PolygonUtils
- java.lang.Object
-
- adams.gui.visualization.image.PolygonUtils
-
public class PolygonUtils extends Object
Helper class for polygons.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Constructor Summary
Constructors Constructor Description PolygonUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Polygon
addVertext(Polygon poly, Point vertex)
Adds the vertex to the polygon at the appropriate position.static Rectangle
boundingBox(List<Point> points)
Returns the bounding box for the polygon.static double
minDistance(Point A, Point B, Point E)
Returns the minimum distance between a line segment AB and a point E.static List<Point>
toPoints(Polygon poly)
Turns the polygon into a list of points.static Polygon
toPolygon(Rectangle rect)
Turns the rectangle into a polygon.static Polygon
toPolygon(List<Point> points)
Returns the bounding box for the polygon.
-
-
-
Method Detail
-
toPolygon
public static Polygon toPolygon(List<Point> points)
Returns the bounding box for the polygon.- Parameters:
points
- the polygon points to calculate the bounding box for- Returns:
- the polygon
-
toPolygon
public static Polygon toPolygon(Rectangle rect)
Turns the rectangle into a polygon.- Parameters:
rect
- the polygon to convert- Returns:
- the polygon
-
toPoints
public static List<Point> toPoints(Polygon poly)
Turns the polygon into a list of points.- Parameters:
poly
- the polygon- Returns:
- the list of points
-
boundingBox
public static Rectangle boundingBox(List<Point> points)
Returns the bounding box for the polygon.- Parameters:
points
- the polygon points to calculate the bounding box for- Returns:
- the bbox
-
minDistance
public static double minDistance(Point A, Point B, Point E)
Returns the minimum distance between a line segment AB and a point E.- Parameters:
A
- the start of the line segmentB
- the end of the line segmentE
- the point to calculate the min distance to- Returns:
- the minimum distance
-
-