Repository navigation
@remotion/paths: Treat arcs with a zero radius as straight lines - #12859
Merged
JonnyBurger merged 1 commit intoNov 1, 2026
Merged
Conversation
The SVG spec draws an `A` command with `rx` or `ry` of 0 as a straight line to its end point. Every sampled point of such an arc was (0, 0), so `getLength()` returned 0, `getPointAtLength()` returned (0, 0) at the start and null after it, and `evolvePath()` returned a `0 0` dash array. Interpolate along the line instead, as the existing comment intended. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Contributor
Contributor
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
One-commit PR making construct() handle zero-radius arcs per the SVG spec ("Out-of-range elliptical arc parameters").
- Zero-radius arc fallback (
packages/paths/src/helpers/arc.ts) —pointOnEllipticalArc()now linearly interpolates betweenp0andp1(p0 + (p1 - p0) * t) instead of returning(0, 0). Becausetis the normalized arc-length fraction formakeArc(), this makesgetLength(),getPointAtLength(),getTangentAtLength()andevolvePath()agree withreduceInstructions()/getBoundingBox()/cutPath(), which already replace such arcs with a line. - Test (
packages/paths/src/test/get-point-at-length.test.ts) — covers the absolute (A) and relative (a) forms: length ≈ 50 and midpoint ≈ (30, 25) forM 10 10 A 0 20 0 0 1 50 40.
I verified the full packages/paths suite locally (107 pass, 0 fail) and confirmed makeArc is the only consumer of pointOnEllipticalArc, so no other behavior is affected.
deepseek-v4.1-flash | 𝕏
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Per the SVG spec ("Out-of-range elliptical arc parameters"), an arc with
rx = 0orry = 0is a straight line to its end point.reduceInstructions()(and sogetBoundingBox()/cutPath()) already does that, butconstruct()didn't:pointOnEllipticalArc()returned(0, 0)for every sample, with the line case left as a commented-out TODO.For
M 10 10 A 0 20 0 0 1 50 40:getLength()getPointAtLength(p, 0)getPointAtLength(p, 25)evolvePath(0.5, p)0 0, offset 050 50, offset ≈25I used Claude Code to write this change.