[svgwg] Path data: Catmull-Rom Command parameters (#797)

verdy-p has just created a new issue for https://github.com/w3c/svgwg:

== Path data: Catmull-Rom Command parameters ==
Please:
* link to the spec section you're talking about, or at least the spec
https://svgwg.org/specs/paths/#PathDataCatmullRomCommand

The parametrization is not at all ideal.
* The first and last control points (both off-curve) should be the first and last required pairs of coordinates.
* All other coordinate pairs (at least one) are on-curve and should be listed in order, but the first on-curve-point should be the current point and does not need to be specified (so these pairs are optional: if there's no third coordinate pair, the curve will be closed and will return to the initial current point)

So the syntax should be:
* R x0 y0  (x y)* xn yn

For example the following would become valid: 
* "M 1,2 R 3,4 5,6"
It will be drawn from on-curve point (1,2) to on-curve point (1,2) inclusively, with (3,4) and (5,6) being the first and last off-curve control point in the standard curve definition and it is equivalent to (this can be used to draw a "cup": the closed curve is still smooth everywhere except at this common starting/ending point):
* "M 1,2 R 3,4 5,6 1,2"

As well:
* "M 1,2 R 3,4 5,6 7,8"
It will be drawn from on-curve point (1,2) to on-curve point (5,6) inclusively, also with (3,4) and (7,8) being the first and last off-curve control point in the standard curve definition

* "M 1,2 R 3,4 5,6 7,8 9,10"
It will be drawn from on-curve point (1,2) to on-curve point (7,8) via on-curve point (5,6) inclusively, also with (3,4) and (9,10) being the first and last off-curve control point in the standard curve definition. You can immediately see that it is also equivalent to two Catmull-Rom curves:
* "M 1,2 R 3,4 5,6 R 7,8 9,10"

In all cases, the penultimate coordinate pair is the new position of the current point after drawing (except when there's only two coordinates pairs, because it takes a default from the initial current point: at end of stroke, the pen will remain at the same position, so the curve is closed).

In that case, there's no issue for first implicitly moving the pen (and breaking the current path). The initial on-curve point is always the current point before the command, and the final on-curve point is also the new current point for the next path segment if needed

----

Note: there's no parameter for the "alpha" value. Do you assume it is only 0.5 (i.e. the "centripetal" type) ?

Or can we set it with some syntax adding it as an initial optional parameter (detected because there will be an odd number of values)?

So:
* "M 1, 2  R  3, 4  5, 6  7, 8"
would be equivalent to:
* "M 1, 2  R 0.5  3, 4 5, 6 7, 8"
(the default alpha value being 0.5 when there's an odd number of parameters)


Please view or discuss this issue at https://github.com/w3c/svgwg/issues/797 using your GitHub account

Received on Thursday, 7 May 2020 05:20:18 UTC