diff --git a/src/Geometry/Polygon.php b/src/Geometry/Polygon.php index 50cf3cb0d..e7bee7bc5 100644 --- a/src/Geometry/Polygon.php +++ b/src/Geometry/Polygon.php @@ -300,7 +300,9 @@ public function align(string $position): self } foreach ($this->points as $point) { - $point->setX($point->getX() - $diff); + $point->setX( + intval($point->getX() - $diff) + ); } return $this; @@ -331,7 +333,9 @@ public function valign(string $position): self } foreach ($this->points as $point) { - $point->setY($point->getY() - $diff); + $point->setY( + intval($point->getY() - $diff), + ); } return $this; @@ -350,16 +354,24 @@ public function rotate(float $angle): self foreach ($this->points as $point) { // translate point to pivot - $point->setX($point->getX() - $this->getPivot()->getX()); - $point->setY($point->getY() - $this->getPivot()->getY()); + $point->setX( + intval($point->getX() - $this->getPivot()->getX()), + ); + $point->setY( + intval($point->getY() - $this->getPivot()->getY()), + ); // rotate point $x = $point->getX() * $cos - $point->getY() * $sin; $y = $point->getX() * $sin + $point->getY() * $cos; // translate point back - $point->setX($x + $this->getPivot()->getX()); - $point->setY($y + $this->getPivot()->getY()); + $point->setX( + intval($x + $this->getPivot()->getX()), + ); + $point->setY( + intval($y + $this->getPivot()->getY()), + ); } return $this;