Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EndpointToCenterArcParams bug #1246

Open
thenewvu opened this issue Dec 24, 2018 · 0 comments
Open

EndpointToCenterArcParams bug #1246

thenewvu opened this issue Dec 24, 2018 · 0 comments

Comments

@thenewvu
Copy link

thenewvu commented Dec 24, 2018

Hello,

This article led me here.

I found a bug in:

//(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 -= 2 * Math.PIf;
r_ = float2((float)rX,(float)rY);
c = float2((float)cx,(float)cy);
angles = float2((float)theta, (float)delta);

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;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant