w3c / svgwg

SVG Working Group specifications
Other
704 stars 132 forks source link

Arc sweep vs clockwise explanation #945

Open JimJJewett opened 4 months ago

JimJJewett commented 4 months ago

An "arc" -- and particularly its sweep parameter -- is never really defined, except as part of a path.

Unfortunately, the meaning is unclear without also looking at the details of the Ellipse Basic Shape. Note that the Ellipse implementation Notes are also not sufficient. (And because the actual meaning differs from reasonable expectations, this should be particularly explicit.)

Because of end-point parameterization, the center of the arc is unknown, and the arc subcommand instead requires large-arc-flag and sweep-flag.

Ideally, sweep-flag would be renamed clockwise-flag, but it may be too late for that.

At a minimum, please make it more explicit which direction the sweep flag indicates. The figure helped, and at least alerted me that something was wrong in my understanding, but I still couldn't make sense of it until I found """The path begins at the "3 o'clock" point on the radius and proceeds in a clock-wise direction (before any transformation)""" inside the Ellipse Basic Shape documentation.

My usual assumption is that an angle would increase in the counter-clockwise direction, as taught in introductory trigonometry.

My alternative assumption is that if an angle grows in the clockwise direction, it will start at the top (North on a compass, or 12 O' Clock).

Instead the SVG angle has zero along the x-coordinate, but increases in the clockwise direction. This is unusual enough that it should be very explicit in both the arc definition and the arc implementation notes.

This issue is at least partially inherited from SVG 1.1 https://www.w3.org/TR/SVG11/paths.html#PathDataEllipticalArcCommands vs https://www.w3.org/TR/SVG11/shapes.html#EllipseElement and https://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes

but is now at https://www.w3.org/TR/SVG2/implnote.html#ArcImplementationNotes

as well as current https://svgwg.org/svg-next/paths.html#PathDataEllipticalArcCommands https://svgwg.org/svg-next/shapes.html#EllipseElement https://svgwg.org/svg-next/implnote.html#ArcImplementationNotes

Crissov commented 4 months ago