Repository navigation
Path: Add arcAround() and arcTowards() - #2470
Merged
Merged
Conversation
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.
Closes #1052
Adds two drawing commands to
PathItem, available onPathandCompoundPath:arcAround(center, angle)draws an arc aroundcenter, starting at the path's current end point and sweepingangledegrees, clockwise for positive angles. Full circles (360°) work, which the issue found impossible witharcTo().arcTowards(to)continues the path in its current direction with an arc that ends exactly atto. The center follows from the tangent at the end of the path. Iftolies 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 asarcTo().Both share the segment construction with
arcTo(), which moves into a helper,addArc().Change in behaviour:
arcTo()added no segment for arcs belowNumerical.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, sincearcAround()allows arcs of more than one turn andarcTo()never produces them.