PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.20
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.20
1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 1.10.0 1.9.17 1.9.15 1.9.16 All 164 releases
woocommerce-pos / vendor_prefixed / chillerlan / php-qrcode / src / Detector / ResultPoint.php

ResultPoint.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.20, at vendor_prefixed/chillerlan/php-qrcode/src/Detector/ResultPoint.php

69 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class ResultPoint
5 *
6 * @created 17.01.2021
7 * @author ZXing Authors
8 * @author Smiley <[email protected]>
9 * @copyright 2021 Smiley
10 * @license Apache-2.0
11 */
12 namespace WCPOS\Vendor\chillerlan\QRCode\Detector;
13
14 use function abs;
15 /**
16 * Encapsulates a point of interest in an image containing a barcode. Typically, this
17 * would be the location of a finder pattern or the corner of the barcode, for example.
18 *
19 * @author Sean Owen
20 */
21 abstract class ResultPoint
22 {
23 protected float $x;
24 protected float $y;
25 protected float $estimatedModuleSize;
26 /**
27 *
28 */
29 public function __construct(float $x, float $y, float $estimatedModuleSize)
30 {
31 $this->x = $x;
32 $this->y = $y;
33 $this->estimatedModuleSize = $estimatedModuleSize;
34 }
35 /**
36 *
37 */
38 public function getX() : float
39 {
40 return $this->x;
41 }
42 /**
43 *
44 */
45 public function getY() : float
46 {
47 return $this->y;
48 }
49 /**
50 *
51 */
52 public function getEstimatedModuleSize() : float
53 {
54 return $this->estimatedModuleSize;
55 }
56 /**
57 * Determines if this finder pattern "about equals" a finder pattern at the stated
58 * position and size -- meaning, it is at nearly the same center with nearly the same size.
59 */
60 public function aboutEquals(float $moduleSize, float $i, float $j) : bool
61 {
62 if (abs($i - $this->y) <= $moduleSize && abs($j - $this->x) <= $moduleSize) {
63 $moduleSizeDiff = abs($moduleSize - $this->estimatedModuleSize);
64 return $moduleSizeDiff <= 1.0 || $moduleSizeDiff <= $this->estimatedModuleSize;
65 }
66 return \false;
67 }
68 }
69