Phpml\Clustering\KMeans\Point::getDistanceWith PHP Method

getDistanceWith() public method

public getDistanceWith ( self $point, boolean $precise = true ) : integer | mixed
$point self
$precise boolean
return integer | mixed
    public function getDistanceWith(self $point, $precise = true)
    {
        $distance = 0;
        for ($n = 0; $n < $this->dimension; ++$n) {
            $difference = $this->coordinates[$n] - $point->coordinates[$n];
            $distance += $difference * $difference;
        }
        return $precise ? sqrt((double) $distance) : $distance;
    }