X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=lib%2Fdrawer.c;fp=lib%2Fdrawer.c;h=1b4f7e9694fdbd3386d7dd4dfdbbcaffc4dede4c;hp=3ff0299820388580f79a8ef2fa3d70a308a24811;hb=6bc6fbc4e85984fbd471e0410ac0fcbbddbb49c4;hpb=f6a3cc71c731c0144b1e137d1bdbe24afdc1c755 diff --git a/lib/drawer.c b/lib/drawer.c index 3ff0299..1b4f7e9 100644 --- a/lib/drawer.c +++ b/lib/drawer.c @@ -168,6 +168,7 @@ static int approximate3(const struct cspline*s, struct qspline*q, int size, doub char left = 0,recurse=0; int t; int probes = 15; + double dx,dy; /* create simple approximation: a qspline which run's through the qspline point at 0.5 */ @@ -202,8 +203,9 @@ static int approximate3(const struct cspline*s, struct qspline*q, int size, doub test.control.y += test.end.y; } +#define PROBES +#ifdef PROBES /* measure the spline's accurancy, by taking a number of probes */ - for(t=0;tend.x - s->control2.x*3 + s->control1.x*3 - s->start.x; + dy= s->end.y - s->control2.y*3 + s->control1.y*3 - s->start.y; + + /* use the integral over (f(x)-g(x))^2 between 0 and 1 + to measure the approximation quality. + (it boils down to const*d^2) + */ + recurse = (dx*dx + dy*dy > quality2); +#endif if(recurse && istep>1 && size-level > num) { istep >>= 1;