Skip to content

Commit

Permalink
:octocat: there's areason why these methods were static...
Browse files Browse the repository at this point in the history
  • Loading branch information
codemasher committed Jul 21, 2024
1 parent 7b1d961 commit a792c9f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Detector/FinderPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,14 @@ public function getCount():int{
* @return float distance between two points
*/
public function getDistance(FinderPattern $b):float{
return $this->distance($this->x, $this->y, $b->x, $b->y);
return self::distance($this->x, $this->y, $b->x, $b->y);
}

/**
* Get square of distance between a and b.
*/
public function getSquaredDistance(FinderPattern $b):float{
return $this->squaredDistance($this->x, $this->y, $b->x, $b->y);
return self::squaredDistance($this->x, $this->y, $b->x, $b->y);
}

/**
Expand All @@ -67,15 +67,15 @@ public function combineEstimate(float $i, float $j, float $newModuleSize):static
);
}

private function squaredDistance(float $aX, float $aY, float $bX, float $bY):float{
private static function squaredDistance(float $aX, float $aY, float $bX, float $bY):float{
$xDiff = ($aX - $bX);
$yDiff = ($aY - $bY);

return ($xDiff * $xDiff + $yDiff * $yDiff);
}

public function distance(float $aX, float $aY, float $bX, float $bY):float{
return sqrt($this->squaredDistance($aX, $aY, $bX, $bY));
public static function distance(float $aX, float $aY, float $bX, float $bY):float{
return sqrt(self::squaredDistance($aX, $aY, $bX, $bY));
}

}

0 comments on commit a792c9f

Please sign in to comment.