env and vendor added temporary
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace BaconQrCode\Renderer\Path;
|
||||
|
||||
final class Move implements OperationInterface
|
||||
{
|
||||
public function __construct(private readonly float $x, private readonly float $y)
|
||||
{
|
||||
}
|
||||
|
||||
public function getX() : float
|
||||
{
|
||||
return $this->x;
|
||||
}
|
||||
|
||||
public function getY() : float
|
||||
{
|
||||
return $this->y;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return self
|
||||
*/
|
||||
public function translate(float $x, float $y) : OperationInterface
|
||||
{
|
||||
return new self($this->x + $x, $this->y + $y);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return self
|
||||
*/
|
||||
public function rotate(int $degrees) : OperationInterface
|
||||
{
|
||||
$radians = deg2rad($degrees);
|
||||
$sin = sin($radians);
|
||||
$cos = cos($radians);
|
||||
$xr = $this->x * $cos - $this->y * $sin;
|
||||
$yr = $this->x * $sin + $this->y * $cos;
|
||||
return new self($xr, $yr);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user