Returns the distance between the end of path i
        and the start of path j.
506138
def cost(self, i, j):
        """"""
        return dist(self.endpoints[i][1], self.endpoints[j][0])
1302845
function calculateScale(start, end) {
        var startDistance = getDistance(start[0], start[1]);
        var endDistance = getDistance(end[0], end[1]);
        return endDistance / startDistance;
    }
1352256
private double preDistance(NumberVector v1, NumberVector v2, final int start, final int end) {
    double agg = 0.;
    for(int d = start; d < end; d++) {
      final double xd = v1.doubleValue(d), yd = v2.doubleValue(d);
      final double delta = xd >= yd ? xd - yd : yd - xd;
      agg += MathUtil.powi(delta, intp);
    }
    return agg;
  }
467214
def relpath(path, start=posixpath.curdir):
    """"""
    if not path:
        raise ValueError("no path specified")

    start_list = posixpath.abspath(start).split(posixpath.sep)
    path_list = posixpath.abspath(path).split(posixpath.sep)

    # Work out how much of the filepath is shared by start and path.
    i = len(posixpath.commonprefix([start_list, path_list]))

    rel_list = [posixpath.pardir] * (len(start_list) - i) + path_list[i:]
    if not rel_list:
        return posixpath.curdir
    return posixpath.join(*rel_list)
557796
function computePathBox(path) {
            var points = [];
            if (arguments.length === 1) {
                points = path;
            }
            else {
                for (var i = 0, l = arguments.length; i < l; i++) {
                    Array.prototype.splice.apply(points, [points.length, 0].concat(arguments[i]));
                }
            }
            return computeBoundingBox(points);
        }
1075469
private float distance(int i, float x, float y, float z) {
        return frustum[i][0] * x + frustum[i][1] * y + frustum[i][2] * z + frustum[i][3];
    }
1150752
def get_midpoint(file, file_start, file_end):
    
    filehandle = open(file, 'r')
    mid_point = (file_start + file_end) / 2
    assert mid_point >= file_start
    filehandle.seek(mid_point)
    line = filehandle.readline()
    assert len(line) >= 1
    if len(line) + mid_point < file_end:
        return mid_point + len(line) - 1
    filehandle.seek(file_start)
    line = filehandle.readline()
    assert len(line) >= 1
    assert len(line) + file_start <= file_end
    return len(line) + file_start - 1
452261
function getCommonPathBase( paths ) {

		var list = [];
		var minLength = 999999999;

		var commonPath = "";

		//break up paths into parts
		paths.forEach( function( file ) {

			//normalize path seperators
			file = file.replace( pathSepRegExp, path.sep );

			//get resolved path parts for file directory
			if ( file.charAt(0) === path.sep ){
				file = file.substr(1);
			}
			//console.log("   "+file);
			//console.log("   "+path.dirname( file ));
			var dirname = path.dirname( file );
			var parts = dirname === "." ? [] : dirname.split( path.sep );
			list.push( parts );

			//save minimum path length for next step
			minLength = Math.min( minLength, parts.length );

		} );

		var listLength = list.length;

		grunt.verbose.writeln( JSON.stringify( list, undefined, "   ") );
		//check for common parts
		if ( listLength > 1 ) {
			var common = true;
			var index = -1;

			//iterate parts up to minLength
			for ( var i = 0; i < minLength; i++ ) {

				for ( var j = 1; j < listLength; j++ ) {
					if ( list[ j ][ i ] !== list[ j - 1 ][ i ] ) {
						common = false;
						break;
					}
				}

				if ( !common ) {
					index = i;
					break;
				}
			}
			//catch case where all paths are common
			if ( index < 0 ){
				index = minLength;
			}

			//build new paths array
			//for ( var n=0; n<listLength; n++ ) {
			//	newPaths.push( path.join( list[n].slice( index ) ) );
			//}

			commonPath = list[0].slice( 0, index ).join( path.sep );

		}
		else if ( listLength === 1 ) {
			commonPath = list[0].join( path.sep );
		}

		return commonPath;

	}
396258
def ApproximateDistanceBetweenStops(stop1, stop2):
  """"""
  if (stop1.stop_lat is None or stop1.stop_lon is None or
      stop2.stop_lat is None or stop2.stop_lon is None):
    return None
  return ApproximateDistance(stop1.stop_lat, stop1.stop_lon,
                             stop2.stop_lat, stop2.stop_lon)
1069258
public static int distanceSq (int x0, int y0, int x1, int y1)
    {
        return ((x1 - x0) * (x1 - x0)) + ((y1 - y0) * (y1 - y0));
    }
214502
def path_join(*args):
    """"""
    return SEP.join((x for x in args if x not in (None, ''))).strip(SEP)
972639
public final double distance(E e1, E e2) {
    return distance(e1.getRoutingObjectID(), e2.getRoutingObjectID());
  }
805211
protected static String getRemainingPath(List<String> tokens, int i, int end) {
        if (tokens == null) {
            throw MESSAGES.nullArgument("tokens");
        }
        if (i < 0 || i >= end) { throw new IllegalArgumentException("i is not in the range of tokens: 0-" + (end - 1)); }
        if (i == end - 1) { return tokens.get(end - 1); }
        StringBuilder buffer = new StringBuilder();
        for (; i < end - 1; ++i) {
            buffer.append(tokens.get(i));
            buffer.append("/");
        }
        buffer.append(tokens.get(end - 1));
        return buffer.toString();
    }
744332
public int dist(int i, int j) {
		int[] anci = treepath[i];
		int[] ancj = treepath[j];
		int k=0;
		for(;k<Math.min(ancj.length, anci.length);k++){
			if(anci[k]!=ancj[k])
				break;
		}
				
		int d = anci.length+ancj.length-2*k+1;
		return d;
	}
1341039
def distance_to(self, other):
        """"""
        return np.linalg.norm(self.position-other.position)
334989
function getScale(start, end) {
    // need two fingers...
    if (start.length >= 2 && end.length >= 2) {
      return this.getDistance(end[0], end[1]) / this.getDistance(start[0], start[1]);
    }
    return 1;
  }
126617
def path_distance(points):
    
    vecs = np.diff(points, axis=0)[:, :3]
    d2 = [np.dot(p, p) for p in vecs]
    return np.sum(np.sqrt(d2))