[PATCH 02/12] d2d1: Add cubic bezier bounds functions.

Henri Verbeet hverbeet at gmail.com
Wed Feb 26 12:32:38 CST 2020


On Tue, 25 Feb 2020 at 22:51, Connor McAdams <conmanx360 at gmail.com> wrote:
> Is there anything that can be done in the case of t_c_cube to lower
> the possibility of that happening?
>
One of the advantages of using de Casteljau is that it's one of the
more numerically stable ways to evaluate Bézier curves. So that's the
easy option. It may also be possible to do something clever by
rewriting things to eliminate the (1 - t) factors, and using something
along the lines of Kahan summation to add things together. (I'm
clearly doing some handwaving here.) That's probably the harder
option.

> I didn't even notice that I wasn't using the constant in that function
> specifically, that value gets used in a later patch. Good catch. I'll
> fix that. Is it a good idea to have a macro constant for values like
> that, or is it better to just make them literals?
>
Well, ideally you'd avoid this kind of function or constant entirely,
and either use something based on the tolerance provided through the
API where applicable, or based on the magnitudes of the values you're
working with.



More information about the wine-devel mailing list