W3C home > Mailing lists > Public > www-svg@w3.org > November 2011

Re: Correct usage of cubic Bézier curve command s/S

From: Rick <graham.rick@gmail.com>
Date: Tue, 22 Nov 2011 08:42:03 -0500
Message-ID: <CAGDjS3d+JuftFzXuAXRL5WSmUh1_x12_LCXpuXz4DbddPa270w@mail.gmail.com>
To: Satz Klauer <satzklauer@googlemail.com>
Cc: www-svg@w3.org

It isn't a reflection in the X axis, it is a coincidence that the example
shows that.  It is a reflection in the sense that the last leg and the next
leg are reflections across the perpendicular at that point in the curve.

To calculate the first control point of a successive s or c add the vector
formed by the last leg of the previous curve to the final point in the
curve.  This produces a tangential 'reflection' and a perfectly smooth
curve with the same degree of 'curveness' at the reflection point.

A simpler way to look at it would be to add the dx and dy of the last
segment of the frame of the previous curve to the final point to get the
first segment of the frame of the next curve.

On Tue, Nov 22, 2011 at 6:55 AM, Satz Klauer <satzklauer@googlemail.com>wrote:

> Hi,
> I've got some troubles in implementing the cubic Bézier curve commands
> s and S correctly. According to the descritption at
> http://www.w3.org/TR/SVG/paths.html#PathDataCubicBezierCommands the
> missing first control point has to be generated by reflecting the
> second control point of the previous Bézier curve command.
> But reflect at what? Reflecting at the X-axis (as shown in the example
> image) doesn't seem to be correct. And reflecting at the intermediate
> point (endpoint of the previous and start point of the current curve)
> causes strange results in my application.
> So how should that be done correctly?
> Elmi

Politicians should wear uniforms like Nascar drivers.
Emblazoned with their corporate sponsors.
Received on Tuesday, 22 November 2011 13:42:34 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:54:33 UTC