public class HullAlgorithm { static double distance (Pointd p, Pointd q) { return Math.sqrt ( (p.x-q.x)*(p.x-q.x) + (p.y-q.y)*(p.y-q.y) ); } public double findLargest (Pointd[] points) { // For each pair of points: compute the distance, recording // the largest such distance: double maxDistance = 0; for (int i=0; i maxDistance) maxDistance = dist; } } return maxDistance; } public double findLargestDistance (Pointd[] points) { // 1. Find the convex hull: Hull hull = new Hull (points); // 2. Extract the points: Pointd[] hullPoints = hull.getPoints(); // 3. Compute an all-pairs largest-distance: return findLargest (hullPoints); } }