public static double overlap(SpatialComparable box1,SpatialComparable box2){
  final int dim=assertSameDimensionality(box1,box2);
  double omax, omin;
  double overlap=1.;
  for (int i=0; i < dim; i++) {
    omax=Math.min(box1.getMax(i),box2.getMax(i));
    omin=Math.max(box1.getMin(i),box2.getMin(i));
    if (omax <= omin) {
      return 0.;
    }
    overlap*=omax - omin;
  }
  return overlap;
}

public static double overlap ( SpatialComparable box1 , SpatialComparable box2 ) { final int dim = assertSameDimensionality ( box1 , box2 ) ; double omax , omin ; double overlap = 1. ; for ( int i = 0 ; i < dim ; i ++ ) { omax = Math . min ( box1 . getMax ( i ) , box2 . getMax ( i ) ) ; omin = Math . max ( box1 . getMin ( i ) , box2 . getMin ( i ) ) ; if ( omax <= omin ) { return 0. ; } overlap *= omax - omin ; } return overlap ; }
computes the volume of the overlapping box between two spatialcomparables .
