public double distance(IMultiPoint imp){
  if (imp.dimensionality() != 2) {
    throw new IllegalArgumentException("distance computation can only be performed between two-dimensional points");
  }
  double ox=imp.getCoordinate(1);
  double oy=imp.getCoordinate(2);
  return Math.sqrt((ox - x) * (ox - x) + (oy - y) * (oy - y));
}

public double distance ( IMultiPoint imp ) { if ( imp . dimensionality ( ) != 2 ) { throw new IllegalArgumentException ( "distance computation can only be performed between two-dimensional points" ) ; } double ox = imp . getCoordinate ( 1 ) ; double oy = imp . getCoordinate ( 2 ) ; return Math . sqrt ( ( ox - x ) * ( ox - x ) + ( oy - y ) * ( oy - y ) ) ; }
return the euclidean distance between the given multipoint . ensures that only valid for two - dimensional comparison .
