Distance

@param int|float $distance_in_m
@return string
493329
public static function distance($distance_in_m) : string {
		if (self::$options['format_uom'] == 'METRIC') {
			return round($distance_in_m / 1000, 2) . i18n(null, 'km');
		} else {
			return round($distance_in_m / 1.60934 / 1000, 2) . i18n(null, 'mi');
		}
	}
161925
def _compute_distance_fast(self):
        """"""
        d, m = edit_distance(self.seq1, self.seq2,
                             action_function=self.action_function,
                             test=self.test)
        if self.dist:
            assert d == self.dist
        if self._matches:
            assert m == self._matches
        self.dist = d
        self._matches = m
454785
protected function useFastBlur($distance) {
        $size = ($distance * 2 + 1) * ($distance * 2 + 1);
        $img = array();
        for ($x = 0; $x < $this->width; ++$x) {
            $img[$x] = array();
            for ($y = 0; $y < $this->height; ++$y) {
                $img[$x][$y] = imagecolorat($this->image, $x, $y);
            }
        }
                
        for ($x = 0; $x < $this->width; ++$x) {
            $maxX = $this->width < $x + $distance ? $this->width : $x + $distance;
            $k1 = $x < $distance ? 0 : $x - $distance;
            
            for ($y = 0; $y < $this->height; ++$y) {
                $maxY = $this->height < $y + $distance ? $this->height : $y + $distance;
                $l1 = $y < $distance ? 0 : $y - $distance;
                $r = $g = $b = 0;
                for($k = $k1; $k < $maxX; ++$k) {
                    $columnK = $img[$k];
                    
                    for ($l = $l1; $l < $maxY; ++$l) {
                        $color = $columnK[$l];
                        
                        $r += ($color >> 16) & 0xff;
                        $g += ($color >> 8) & 0xff;
                        $b += $color & 0xff;
                    }
                }
                $size = ($maxX - $k1) * ($maxY - $l1);               
                
                $r /= $size;
                $g /= $size;
                $b /= $size;
                imagesetpixel($this->image, $x, $y, $r << 16 | $g << 8 | $b);
            }
        }
        return $this;
    }
792009
def distance_to(self, *args):
        """"""
        if not len(args) > 0:
            raise ValueError("at least one parameter must be given")

        x = args[0]
        if len(args) > 1:
            unit = args[1]
        else:
            unit = "px"
        u = {"px": (1.,1.), "in": (1.,72.), "cm": (2.54, 72.),
             "mm": (25.4, 72.)}
        f = u[unit][0] / u[unit][1]
        if type(x) is Point:
            return abs(self - x) * f

# from here on, x is a rectangle
# as a safeguard, make a finite copy of it
        r = Rect(x.top_left, x.top_left)
        r = r | x.bottom_right
        if self in r:
            return 0.0
        if self.x > r.x1:
            if self.y >= r.y1:
                return self.distance_to(r.bottom_right, unit)
            elif self.y <= r.y0:
                return self.distance_to(r.top_right, unit)
            else:
                return (self.x - r.x1) * f
        elif r.x0 <= self.x <= r.x1:
            if self.y >= r.y1:
                return (self.y - r.y1) * f
            else:
                return (r.y0 - self.y) * f
        else:
            if self.y >= r.y1:
                return self.distance_to(r.bottom_left, unit)
            elif self.y <= r.y0:
                return self.distance_to(r.top_left, unit)
            else:
                return (r.x0 - self.x) * f
439871
public function useBlur($distance) {
        if($this->useBooster || $this->width * $this->height < 100000) {
            return $this->useFastBlur($distance);
        }
        $cache = array(array());
        
        for ($x = 0; $x < $this->width; ++$x) {
            $maxX = $this->width < $x + $distance ? $this->width : $x + $distance;
            $k1 = $x < $distance ? 0 : $x - $distance;
            
            for ($y = 0; $y < $this->height; ++$y) {
                $maxY = $this->height < $y + $distance ? $this->height : $y + $distance;
                $l1 = $y < $distance ? 0 : $y - $distance;
                $r = $g = $b = 0;
                
                for($k = $k1; $k < $maxX; ++$k) {
                    for ($l = $l1; $l < $maxY; ++$l) {
                        if(isset($cache[$k][$l])) {
                            $color = $cache[$k][$l];
                        } else {
                            $color = imagecolorat($this->image, $k, $l);// $columnK[$l];
                            $cache[$k][$l] = $color;
                        }
                        
                        $r += ($color >> 16) & 0xff;
                        $g += ($color >> 8) & 0xff;
                        $b += $color & 0xff;
                    }

                    if($k % 32 === 0 && $l % 16 === 0) {
                        $cache = array(array());
                    }
                }
                $size = ($maxX - $k1) * ($maxY - $l1);               
                
                $r /= $size;
                $g /= $size;
                $b /= $size;
                imagesetpixel($this->image, $x, $y, $r << 16 | $g << 8 | $b);
            }
        }
        return $this;
    }
852425
public static float distance (Point source, Point dest)
    {
        return MathUtil.distance(source.x, source.y, dest.x, dest.y);
    }
953626
public function geo_distance(string $key, $location, string $distance): GeoDistance
    {
        return new GeoDistance($key, $location, $distance);
    }
654835
public static int getVertexCountAtDistance(IAtomContainer atomContainer, int distance) {
        int natom = atomContainer.getAtomCount();

        int[][] admat = AdjacencyMatrix.getMatrix(atomContainer);
        int[][] distanceMatrix = computeFloydAPSP(admat);

        int matches = 0;

        for (int i = 0; i < natom; i++) {
            for (int j = 0; j < natom; j++) {
                if (distanceMatrix[i][j] == distance) matches++;
            }
        }
        return matches / 2;
    }
779318
def Distance(lat1, lon1, lat2, lon2):
    """"""

    az12, az21, dist = wgs84_geod.inv(lon1, lat1, lon2, lat2)
    return az21, dist
405541
private function _distance( $out, $key )
    {
        return $this->distanceBetweenPoints(
            $this->points[$out],
            $this->points[$key]
        );
    }
608010
def distance(other)
      @globe.inverse(phi, la, other.phi, other.la).first
    end
881891
def distance
      return nil unless @locations.size > 1
      locations.each_cons(2).reduce(0) do |acc, (loc1, loc2)|
        acc + loc1.distance_to(loc2)
      end
    end
368823
public static function getMemoryLimit()
    {
        $iniVal = ini_get('memory_limit');
        $val = $iniVal !== ''
            ? $iniVal
            : ( version_compare(PHP_VERSION, '5.2.0', '>')
                ? '128M'
                : ( version_compare(PHP_VERSION, '5.2.0', '=')
                    ? '16M'
                    : '8M'
                )
            );
        return $val;
    }
1136421
def get_distance_coefficients(self, C, imt):
        
        c3 = self.c3[imt]["c3"] if self.c3 else C["c3"]
        return c3
737523
def get_distance_matrix(x):
    """"""
    square = nd.sum(x ** 2.0, axis=1, keepdims=True)
    distance_square = square + square.transpose() - (2.0 * nd.dot(x, x.transpose()))
    return nd.sqrt(distance_square)
684037
def _get_distance_term(self, C, rhypo, mag):
        
        h_eff = self._get_effective_distance(mag)
        r_val = np.sqrt(rhypo ** 2.0 + h_eff ** 2.0)
        return C["c3"] * np.log10(r_val)
1367064
public function getDistance() : ?string 
    {
        if ( ! $this->hasDistance()) {
            $this->setDistance($this->getDefaultDistance());
        }
        return $this->distance;
    }