From dab40442de62cb69f3f5c6b2163f717c2e95f569 Mon Sep 17 00:00:00 2001 From: Marcus Jaschen Date: Sun, 3 Dec 2023 08:57:16 +0100 Subject: [PATCH] use proper variable as index for array access --- CHANGELOG.md | 10 ++++++++-- src/Polygon.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 613aa6a..a72a52a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,9 +15,15 @@ Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) princip - `setPoint1()` and `setPoint2()` methods from `Line` - `setSeparator()`, `useCardinalLetters()` and `setUnits()` methods from `DMS` -## [4.2.0] - Current Version, 2022-07-25 +## [4.2.1] - 2023-12-03 -## Changed +### Changed + +- use proper variable as index for array access + +## [4.2.0] - 2022-07-25 + +### Changed - point-to-line distance is calculated iteratively now, fixes #92 - improved intersection checking for polygon/polygon diff --git a/src/Polygon.php b/src/Polygon.php index 1582366..3d1cc46 100644 --- a/src/Polygon.php +++ b/src/Polygon.php @@ -114,7 +114,7 @@ public function getSegments(): array // to close the polygon we have to add the final segment between // the last point and the first point - $segments[] = new Line($this->points[$i - 1], $this->points[0]); + $segments[] = new Line($this->points[$length - 1], $this->points[0]); return $segments; }