Close.php
1 week ago
Curve.php
1 week ago
EllipticArc.php
1 week ago
Line.php
1 week ago
Move.php
1 week ago
OperationInterface.php
1 week ago
Path.php
1 week ago
index.php
1 week ago
Curve.php
73 lines
| 1 | <?php |
| 2 | |
| 3 | declare (strict_types=1); |
| 4 | namespace WP2FA_Vendor\BaconQrCode\Renderer\Path; |
| 5 | |
| 6 | final class Curve implements OperationInterface |
| 7 | { |
| 8 | /** |
| 9 | * @var float |
| 10 | */ |
| 11 | private $x1; |
| 12 | /** |
| 13 | * @var float |
| 14 | */ |
| 15 | private $y1; |
| 16 | /** |
| 17 | * @var float |
| 18 | */ |
| 19 | private $x2; |
| 20 | /** |
| 21 | * @var float |
| 22 | */ |
| 23 | private $y2; |
| 24 | /** |
| 25 | * @var float |
| 26 | */ |
| 27 | private $x3; |
| 28 | /** |
| 29 | * @var float |
| 30 | */ |
| 31 | private $y3; |
| 32 | public function __construct(float $x1, float $y1, float $x2, float $y2, float $x3, float $y3) |
| 33 | { |
| 34 | $this->x1 = $x1; |
| 35 | $this->y1 = $y1; |
| 36 | $this->x2 = $x2; |
| 37 | $this->y2 = $y2; |
| 38 | $this->x3 = $x3; |
| 39 | $this->y3 = $y3; |
| 40 | } |
| 41 | public function getX1() : float |
| 42 | { |
| 43 | return $this->x1; |
| 44 | } |
| 45 | public function getY1() : float |
| 46 | { |
| 47 | return $this->y1; |
| 48 | } |
| 49 | public function getX2() : float |
| 50 | { |
| 51 | return $this->x2; |
| 52 | } |
| 53 | public function getY2() : float |
| 54 | { |
| 55 | return $this->y2; |
| 56 | } |
| 57 | public function getX3() : float |
| 58 | { |
| 59 | return $this->x3; |
| 60 | } |
| 61 | public function getY3() : float |
| 62 | { |
| 63 | return $this->y3; |
| 64 | } |
| 65 | /** |
| 66 | * @return self |
| 67 | */ |
| 68 | public function translate(float $x, float $y) : OperationInterface |
| 69 | { |
| 70 | return new self($this->x1 + $x, $this->y1 + $y, $this->x2 + $x, $this->y2 + $y, $this->x3 + $x, $this->y3 + $y); |
| 71 | } |
| 72 | } |
| 73 |