freetype-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ft-devel] rounding errors when splitting


From: Alexei Podtelezhnikov
Subject: [ft-devel] rounding errors when splitting
Date: Thu, 21 Feb 2013 14:51:56 -0500

Hi All,

I wanted to know your opinion on the rounding errors when splitting
Bezier segments. This is what FreeType is doing for a conic segment
(p1,p2,p3). Two new segments are as follows

q1 = p1;
q2 = (p1 + p2)/2;  <-- rounding down here
r2 = (p2 + p3)/2;  <-- rounding down here
r3 = p3;
q3 = r1 = (q2+r2)/2 <- rounding down here again

The last line is applied to the already-rounded numbers, so it is
double rounded so to speak. What one could do instead is this:

q3 = r1 = (p1 + 2*p2 + p3)/4

with less error. For example,

(10,25,20) -> (10,17,19)(19,22,20)  with current method
(10,25,20) -> (10,17,20)(20,22,20)  with alternative method

So we have an off-by-1 error because 20 is the correct answer for the
middle point. The situation is even worse with cubic segments where we
have triple rounding with possible off-by-2 error. Of course, there is
price for extra accuracy: the alternative method would overflow one
bit quicker for conic and 3 bits quicker for cubic segments.

Is this something worth improving? What's your opinion?

Thank you,
Alexei



reply via email to

[Prev in Thread] Current Thread [Next in Thread]