fuselibs icon indicating copy to clipboard operation
fuselibs copied to clipboard

EndpointToCenterArcParams bug

Open thenewvu opened this issue 6 years ago • 0 comments

Hello,

This article led me here.

I found a bug in:

https://github.com/fuse-open/fuselibs/blob/8fb40bb957ff3b32252863a0a04f3cb298f7d24e/Source/Fuse.Drawing.Surface/SurfaceUtil.uno#L138-L148

According to the spec (the bold text):

where Δθ is fixed in the range −360° < Δθ < 360° such that:

if fS = 0, then Δθ < 0,

else if fS = 1, then Δθ > 0.

In other words, if fS = 0 and the right side of (eq. 5.6) is greater than 0, then subtract 360°, whereas if fS = 1 and the right side of (eq. 5.6) is less than 0, then add 360°. In all other cases leave it as is.

... the code should be:

    //(F.6.5.6)
    double delta = svgAngle(
        (x1p - cxp)/rX, (y1p - cyp)/rY,
        (-x1p - cxp)/rX, (-y1p-cyp)/rY);
    delta = Math.Mod(delta, Math.PIf * 2 );
    if (flagS && delta < 0)
    {
        delta += 2 * Math.PIf;
    }
    else if (!flagS && delta > 0)
    {
        delta -= 2 * Math.PIf;
    }

thenewvu avatar Dec 24 '18 14:12 thenewvu