Re: [csswg-drafts] [css-shapes] New `<shape-command>`: `plot` do draw graphs (#12224)

An issue I see with either proposal is when the function isn't continuous. I'll consider jump discontinuities (other kinds left as an exercise 😉). Just sampling and connecting the dots would fill the jumps with segments. Sometimes it may be what the author desires, so perhaps there should be an option (a keyword?) for that. But I think most of the time they want there to be a discontinuity. With what little maths is expressible in this way, I believe it's feasible to determine all the jumps and arbitrarily well approximate both ends of each. The sampling would then proceed with maximal intervals of continuity, their ends approximated.

Some technicalities come to mind:

- If a jump is small (like, less than a tiny fraction of a CSS pixel; though the spec would probably state it as an implementation-dependent cutoff), it can be filled with a segment anyway, removing the discontinuity. This reduces the number of arcs over which sampling proceeds.
- The above MUST be used, increasing the cutoff distance if necessary, to reduce the number of arcs to a finite value, if infinite. (It can happen, but only countably many, with currently available functions.)
- Implementations MAY fill some jumps if the number thereof is excessive. Additionally, state is as MUST, SHOULD or MAY (with recommendation to make best effort; implementation quality issue) that if a jump is thus filled, so are all jumps of smaller distances.
- Possibly, if it makes implementations easier and doesn't significantly limit use cases, allow segments to be substituted for small jumps over more than one (including infinitely many) discontinuities at once, from the start of the first one to the end of the last one included.
- Possibly, limit the above only to cases in which the mathematical curve deviates from the substituted segment by only a small distance.

And two more, orthogonal to handling discontinuity:

- Possibly, state it as a SHOULD requirement that the sampling granularity, as well as the cutoff numbers discussed above, depend on magnification and resolution. Authors may e.g. use `transform` to extract a particular miniscule bend from a mathematical curve.
- The sampling granularity SHOULD increase on some intervals in order to better approximate the curve where it has many bends or its parametrization goes over some arc faster.

-- 
GitHub Notification of comment by ByteEater-pl
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/12224#issuecomment-2906278617 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 24 May 2025 01:47:09 UTC