docs: @Override
  	public double execute(Geometry geom1, Geometry geom2,
  			ProgressTracker progressTracker) {
  		if (null == geom1 || null == geom2) {
  			throw new IllegalArgumentException();
  		}
  
  		Geometry geometryA = geom1;
  		Geometry geometryB = geom2;
  
  		if (geometryA.isEmpty() || geometryB.isEmpty())
  			return NumberUtils.TheNaN;		
  
  		Polygon polygonA;
  		Polygon polygonB;
  		MultiPoint multiPointA;
  		MultiPoint multiPointB;
  
  		// if geometryA is an envelope use a polygon instead (if geom1 was
  		// folded, then geometryA will already be a polygon)
  		// if geometryA is a point use a multipoint instead
  		Geometry.Type gtA = geometryA.getType();
  		Geometry.Type gtB = geometryB.getType();
  		if (gtA == Geometry.Type.Point) {
  			if (gtB == Geometry.Type.Point) {
  				return Point2D.distance(((Point)geometryA).getXY(), ((Point)geometryB).getXY());
  			}
  			else if (gtB == Geometry.Type.Envelope) {
  				Envelope2D envB = new Envelope2D();
  				geometryB.queryEnvelope2D(envB);
  				return envB.distance(((Point)geometryA).getXY());
  			}
  			
  			multiPointA = new MultiPoint();
  			multiPointA.add((Point) geometryA);
  			geometryA = multiPointA;
  		} else if (gtA == Geometry.Type.Envelope) {
  			if (gtB == Geometry.Type.Envelope) {
  				Envelope2D envA = new Envelope2D();
  				geometryA.queryEnvelope2D(envA);
  				Envelope2D envB = new Envelope2D();
  				geometryB.queryEnvelope2D(envB);
  				return envB.distance(envA);
  			}
  			polygonA = new Polygon();
  			polygonA.addEnvelope((Envelope) geometryA, false);
  			geometryA = polygonA;
  		}
  
  		// if geom_2 is an envelope use a polygon instead
  		// if geom_2 is a point use a multipoint instead
  		if (gtB == Geometry.Type.Point) {
  			multiPointB = new MultiPoint();
  			multiPointB.add((Point) geometryB);
  			geometryB = multiPointB;
  		} else if (gtB == Geometry.Type.Envelope) {
  			polygonB = new Polygon();
  			polygonB.addEnvelope((Envelope) geometryB, false);
  			geometryB = polygonB;
  		}
  
  		DistanceCalculator distanceCalculator = new DistanceCalculator(
  				progressTracker);
  		double distance = distanceCalculator.calculate(geometryA, geometryB);
  		return distance;
  	}