> I take that back. Moreover, I'm convinced with 4 you still get very noticeable artefacts with correctly-constructed fonts.
> When
I was thinking through it last time I was mistakenly thinking that
there are three roots, whereas there are five. Moreover, the positions
of the roots
> can be arbitrarily close to each other. Moreover, there's
no fast criteria to know the quality of the Raphson output or know when
to terminate. As such, I
> believe the method cannot be made correct (as
in not producing artefacts) and fast at the same time.
> So I go back to my suggestion earlier on: that you convert cubics
to a series of quadratics. Note how that conversion needs to be done
once only, not per pixel.
>
> For the conversion I suggest lifting the core ideas from cu2qu:
>
>
> ideally withe cusp issue handled:
>
I will try to optimize Newton's method (will also try to remove artifacts) and will also check the performance of converting cubic to
quadratic, then we can finally decide what to use.
> I understand why you are doing it. I believe it's not necessary.
Let me try again. See if you can prove the following for yourself.
> I
have proved it and can share. (Only if we had a mathematician around
;)).
>
> Lemma: if the closest point on curve [0,1]
is to the endpoint at t=1 and the cubic equation has no real root at
t=1, the cubic equation must have at least one real root at some t >
1.
> Similarly, if the closest point on curve [0,1] is to the endpoint at
t=0 and the cubic equation has no real root at t=0, the cubic equation
must have at least one real root at some t > 1.
>
> As such, you just need to compute all real roots, clamp them to [0,1] and remove duplicates.
[there is a typo, it should be t < 1 at the last point]
I tried to use this and it works exactly the same as before but faster. Thanks for that.
I can't quite figure out the proof, here is what I think:
The cubic equation here is used to find the perpendicular to the curve.
Now, if we forget about the range [0, 1] the perpendicular can be anywhere.
Moreover, the slope of curve is given by a linear equation ( y = mx + c ),
that means it varies from [-90, 90] (tan(x) varies from [-inf, inf]: this
is also the reason why there has to be at least one real root/perpendicular).
So, if we extend the endpoints we will get a perpendicular somewhere down the
line, but I can't figure out why it is at t > 1 if the nearest point is at t = 1
and vice versa. It will be great if you can share your proof.
Thanks for the comments and your improvements, I will read Lengye's paper and let you know.
Regards,
Anuj