//================================= PointPair ============================= // // Class that holds two points (for example a candidate for the closes // pair of points) and their Euclidean distance. You can modify this // if you'd like. class PointPair { public final static double INF = java.lang.Double.POSITIVE_INFINITY; public XYPoint p1; //the first point of the pair public XYPoint p2; //the second point of the pair public double dist; //their distance PointPair(){ p1 = null; p2 = null; dist = INF; } PointPair(XYPoint p1, XYPoint p2){ this.p1 = p1; this.p2 = p2; this.dist = p1.dist(p2); } public String toString(){ return (" " + this.p1 + " and " + this.p2 + " with distance " + this.dist); } }