Passed
Push — v5 ( 93618e...84eb31 )
by smiley
01:52
created

AlignmentPattern::combineEstimate()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 4
c 1
b 0
f 0
nc 1
nop 3
dl 0
loc 5
rs 10
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
12
namespace chillerlan\QRCode\Detector;
13
14
/**
15
 * <p>Encapsulates an alignment pattern, which are the smaller square patterns found in
16
 * all but the simplest QR Codes.</p>
17
 *
18
 * @author Sean Owen
19
 */
20
final class AlignmentPattern extends ResultPoint{
21
22
	/**
23
	 * Combines this object's current estimate of a finder pattern position and module size
24
	 * with a new estimate. It returns a new {@code FinderPattern} containing an average of the two.
25
	 */
26
	public function combineEstimate(float $i, float $j, float $newModuleSize):AlignmentPattern{
27
		return new self(
28
			($this->x + $j) / 2.0,
29
			($this->y + $i) / 2.0,
30
			($this->estimatedModuleSize + $newModuleSize) / 2.0
31
		);
32
	}
33
34
}
35