AlignmentPattern.php 871 B

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