Skip to content

@remotion/paths: Treat arcs with a zero radius as straight lines - #12859

Merged
JonnyBurger merged 1 commit into
remotion-dev:mainfrom
b84330808:fix-zero-radius-arc-length
Nov 1, 2026
Merged

JonnyBurger merged 1 commit into
remotion-dev:mainfrom
b84330808:fix-zero-radius-arc-length

Conversation

@b84330808

Copy link
Copy Markdown
Contributor

Per the SVG spec ("Out-of-range elliptical arc parameters"), an arc with rx = 0 or ry = 0 is a straight line to its end point. reduceInstructions() (and so getBoundingBox()/cutPath()) already does that, but construct() 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:

before after
getLength() 0 50
getPointAtLength(p, 0) (0, 0) (10, 10)
getPointAtLength(p, 25) null (30, 25)
evolvePath(0.5, p) 0 0, offset 0 ≈50 50, offset ≈25

I used Claude Code to write this change.

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]>
@vercel

vercel Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
bugs Ready Ready Preview Nov 1, 2026 8:31am UTC
remotion Ready Ready Preview Nov 1, 2026 8:31am UTC

Request Review

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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 between p0 and p1 (p0 + (p1 - p0) * t) instead of returning (0, 0). Because t is the normalized arc-length fraction for makeArc(), this makes getLength(), getPointAtLength(), getTangentAtLength() and evolvePath() agree with reduceInstructions()/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) for M 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.

Pullfrog  | View workflow run | Using deepseek-v4.1-flash | 𝕏

@JonnyBurger
JonnyBurger merged commit cf54f1c into remotion-dev:main Nov 1, 2026
20 checks passed

This branch was successfully deployed

2 active deployments
Preview – remotion — fb72018c Deployed Nov 1, 2026 by vercel[bot]
Preview – bugs — fb72018c Deployed Nov 1, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants