cokelid

Filled arc not covering entire angle

Recommended Posts

I'm trying to draw something like a pie-chart style with filled wedges / arcs. However when I do a filled arc it does not quite fill the entire angle-span.

E.g. These two arcs span different angles, even though the calls to graphics.arc are identical...

    // Filled Arc
    graphics.lineStyle(1, 0xffd900, 1);
    graphics.beginFill(0xFF700B);
    graphics.arc(0, 0, r, game.math.degToRad(0), game.math.degToRad(90), true);
    graphics.endFill();
    
    // Non-filled Arc
    graphics.lineStyle(1, 0x00ffff, 1);
    graphics.arc(0, 0, r, game.math.degToRad(0), game.math.degToRad(90), true);

 

See here: //phaser.io/sandbox/VouJszKL/play

The non-filled arc covers the full 270 degrees, but the filled arc is missing the last bit.

Any ideas?

Thanks!

Share this post


Link to post
Share on other sites

You can set the accuracy/fidelity as a final argument:

graphics.arc(0, 0, r, game.math.degToRad(0), game.math.degToRad(90), true,800);

http://phaser.io/docs/2.6.1/PIXI.Graphics.html#arc

it will add more segments/ calculation points to your arc.I think (after measuring) your execution time will increase linearly, but you cannot really see a difference in the arc above 800-1000 segments.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.