@@ -41,14 +41,14 @@ public function getCount():int{
41
41
* @return float distance between two points
42
42
*/
43
43
public function getDistance (FinderPattern $ b ):float {
44
- return $ this -> distance ($ this ->x , $ this ->y , $ b ->x , $ b ->y );
44
+ return self :: distance ($ this ->x , $ this ->y , $ b ->x , $ b ->y );
45
45
}
46
46
47
47
/**
48
48
* Get square of distance between a and b.
49
49
*/
50
50
public function getSquaredDistance (FinderPattern $ b ):float {
51
- return $ this -> squaredDistance ($ this ->x , $ this ->y , $ b ->x , $ b ->y );
51
+ return self :: squaredDistance ($ this ->x , $ this ->y , $ b ->x , $ b ->y );
52
52
}
53
53
54
54
/**
@@ -67,15 +67,15 @@ public function combineEstimate(float $i, float $j, float $newModuleSize):static
67
67
);
68
68
}
69
69
70
- private function squaredDistance (float $ aX , float $ aY , float $ bX , float $ bY ):float {
70
+ private static function squaredDistance (float $ aX , float $ aY , float $ bX , float $ bY ):float {
71
71
$ xDiff = ($ aX - $ bX );
72
72
$ yDiff = ($ aY - $ bY );
73
73
74
74
return ($ xDiff * $ xDiff + $ yDiff * $ yDiff );
75
75
}
76
76
77
- public function distance (float $ aX , float $ aY , float $ bX , float $ bY ):float {
78
- return sqrt ($ this -> squaredDistance ($ aX , $ aY , $ bX , $ bY ));
77
+ public static function distance (float $ aX , float $ aY , float $ bX , float $ bY ):float {
78
+ return sqrt (self :: squaredDistance ($ aX , $ aY , $ bX , $ bY ));
79
79
}
80
80
81
81
}
0 commit comments