public class SmallestEnclosingCircle
This class provides methods necessary for determining creating a new point
which minimizes the maximum distance from the new point to any point in
a given set of points in the plane. Useful for relocating registers.
public static Point getCenterPoint(HashSet<Point> pointsSet)
Returns a new point which is the center of the smallest enclosing circle
on points. This minimizes the maximum distance from the new point to any
other point in points.
pointsSet - the points in the set to consider.
Point, the center of the smallest enclosing circle.
public static ArrayList<Point> convexHull(ArrayList<Point> points)
Given a set of points, returns the set of points in the convex hull in
Performs a 2D cross product of OA and OB vectors. Returns a positive value if
OAB makes a counter-clockwise turn, negative for a clockwise turn, and zero if
the points are collinear.
o - Point O
a - Point A
b - Point B
int, the cross product
public static void printPoints(HashSet<Point> points)