Skip to content

Path: Add arcAround() and arcTowards() - #2470

Merged
lehni merged 1 commit into
developfrom
feature/1052
Oct 26, 2026
Merged

lehni merged 1 commit into
developfrom
feature/1052

Conversation

@lehni

@lehni lehni commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Closes #1052

Adds two drawing commands to PathItem, available on Path and CompoundPath:

  • arcAround(center, angle) draws an arc around center, starting at the path's current end point and sweeping angle degrees, clockwise for positive angles. Full circles (360°) work, which the issue found impossible with arcTo().
  • arcTowards(to) continues the path in its current direction with an arc that ends exactly at to. The center follows from the tangent at the end of the path. If to lies straight ahead on the tangent, it draws a line; if it lies straight behind, or the path has no direction yet, it throws the same error as arcTo().

Both share the segment construction with arcTo(), which moves into a helper, addArc().

Change in behaviour: arcTo() added no segment for arcs below Numerical.ANGULAR_EPSILON (0.00001°), so the path didn't reach its end point, and it cleared the start segment's handle out. Such arcs are now drawn as a straight line, unless they end exactly where they start, in which case nothing is added. The fixed count of 4 segments for arcs of 360° and more is gone, since arcAround() allows arcs of more than one turn and arcTo() never produces them.

@lehni
lehni merged commit 9d6ac2c into develop Oct 26, 2026
5 checks passed
@lehni
lehni deleted the feature/1052 branch October 26, 2026 17:34
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.

Can we get a nicer arc api? (center, radius, startingAngle, sweepAngle)

1 participant