freetype-devel
[Top][All Lists]

## Re: [ft-devel] regarding freetype 2 cubic curve flattening

 From: Vivek Rathod Subject: Re: [ft-devel] regarding freetype 2 cubic curve flattening Date: Mon, 31 Oct 2011 12:52:18 +0530

On Mon, Oct 31, 2011 at 5:46 AM, Alexei Podtelezhnikov wrote:
> On 30/10/2011 08:25, Vivek Rathod wrote:
> according to Hain's paper
> dmax = (s/L) * dnorm ;  here s  is not normalized. dmax is the tolerance for
> flatness and dnorm is the normalized flatness of the curve.
>
> so s_limit = (dmax / dnorm) * L ; by putting dnorm = 0.75 we get the
> permissible height of the control point for the curve not to be split.
>
> so should we  not be comparing s= abs(dy * dxi - dx * dyi) with s_limit *
> L    instead of s and s_limit  ( because s is perpendicular distance of
> control point multiplied by L) ?

It is actually not just cross-product but

s = abs(dx * dxi - dx * dyi)  / L

otherwise the dimensionality is wrong.
Some Hain's equations just need to be creatively modified to avoid divisions
in the code.
Alexei, I understand the subtle modifications made to avoid division. But I still feel s_limit needs to be multiplied another time by L before making the comparison.

s is calculated as
"s = FT_ABS( dy * dx1 - dx * dy1 );"   which means s is the perpendicular distance of the control point from chord multiplied by L

which means currently  s_limit is being compared with perpendicular distance of control point * L .

but s_limit is actual distance, so in order to do the correct comparison (and to avoid division) don't you think we need to multiply s_limit once more by ?