| 1 |
<?php |
| 2 |
/** |
| 3 |
* Class AlignmentPattern |
| 4 |
* |
| 5 |
* @created 17.01.2021 |
| 6 |
* @author ZXing Authors |
| 7 |
* @author Smiley <[email protected]> |
| 8 |
* @copyright 2021 Smiley |
| 9 |
* @license Apache-2.0 |
| 10 |
*/ |
| 11 |
declare(strict_types=1); |
| 12 |
|
| 13 |
namespace chillerlan\QRCode\Detector; |
| 14 |
|
| 15 |
/** |
| 16 |
* Encapsulates an alignment pattern, which are the smaller square patterns found in |
| 17 |
* all but the simplest QR Codes. |
| 18 |
* |
| 19 |
* @author Sean Owen |
| 20 |
*/ |
| 21 |
final class AlignmentPattern extends ResultPoint{ |
| 22 |
|
| 23 |
/** |
| 24 |
* Combines this object's current estimate of a finder pattern position and module size |
| 25 |
* with a new estimate. It returns a new FinderPattern containing an average of the two. |
| 26 |
*/ |
| 27 |
public function combineEstimate(float $i, float $j, float $newModuleSize):static{ |
| 28 |
return new self( |
| 29 |
(($this->x + $j) / 2.0), |
| 30 |
(($this->y + $i) / 2.0), |
| 31 |
(($this->estimatedModuleSize + $newModuleSize) / 2.0), |
| 32 |
); |
| 33 |
} |
| 34 |
|
| 35 |
} |