/**
  * @param left
  * @param right
  * @return
  */
 public static double completeLinkage(
     final HierarchicalAgglomerative left, final HierarchicalAgglomerative right) {
   Set<Point> leftPoints;
   Set<Point> rightPoints;
   double distance;
   if ((left != null) && (right != null)) {
     distance = 0.0;
     leftPoints = left.getPoints();
     rightPoints = right.getPoints();
     for (Point leftPoint : leftPoints) {
       for (Point rightPoint : rightPoints) {
         distance = Math.max(distance, Point.euclideanDistance(leftPoint, rightPoint));
       }
     }
   } else {
     distance = -1.0;
   }
   return distance;
 }
 /**
  * @param left
  * @param right
  * @return
  */
 public static double centroid(
     final HierarchicalAgglomerative left, final HierarchicalAgglomerative right) {
   Set<Point> leftPoints;
   Set<Point> rightPoints;
   double distance;
   if ((left != null) && (right != null)) {
     distance = 0.0;
     leftPoints = left.getPoints();
     rightPoints = right.getPoints();
     for (Point leftPoint : leftPoints) {
       for (Point rightPoint : rightPoints) {
         distance += Point.euclideanDistance(leftPoint, rightPoint);
       }
     }
     distance /= (double) leftPoints.size() * (double) rightPoints.size();
   } else {
     distance = -1.0;
   }
   return distance;
 }