From b6ad6989a4eb9c4ee859183f460387ccfc49bbab Mon Sep 17 00:00:00 2001 From: "Ben Scholzen (DASPRiD)" Date: Sun, 5 Apr 2026 19:44:33 +0200 Subject: [PATCH] fix(eps): correct elliptic arc to curve conversion sweep handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The sweep direction logic in EllipticArc::toCurves() did not follow SVG spec F.6.5.6 correctly. It unconditionally subtracted 2π when sweep was false, and never handled the sweep=true with negative delta case. This caused some arcs to trace the wrong direction, resulting in broken rounded corners when rendering QR codes as EPS. Closes #150 Co-Authored-By: Claude Opus 4.6 (1M context) --- src/Renderer/Path/EllipticArc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Renderer/Path/EllipticArc.php b/src/Renderer/Path/EllipticArc.php index ee957d4..800a032 100644 --- a/src/Renderer/Path/EllipticArc.php +++ b/src/Renderer/Path/EllipticArc.php @@ -213,8 +213,10 @@ private function calculateCenterPointParameters(float $fromX, float $fromY, floa $delta = self::angle(($x1p - $cxp) / $rX, ($y1p - $cyp) / $rY, (-$x1p - $cxp) / $rX, (-$y1p - $cyp) / $rY); $delta = fmod($delta, pi() * 2); - if (! $this->sweep) { + if (! $this->sweep && $delta > 0) { $delta -= 2 * pi(); + } elseif ($this->sweep && $delta < 0) { + $delta += 2 * pi(); } return [$cx, $cy, $rX, $rY, $theta, $delta];