P5.js: Inconsistent behavior for arc

Created on 1 Jul 2020  路  5Comments  路  Source: processing/p5.js

When start angle and end angle are both 2*PI, arc in PIE mode draws a small dot but all other modes do not. To keep the behavior consistent, maybe none of the modes should draw anything when the delta is 0?

Screen Shot 2020-06-30 at 6 34 16 PM

(Scroll down for code)

Most appropriate sub-area of p5.js?

  • [ ] Color
  • [x] Core/Environment/Rendering
  • [ ] Data
  • [ ] Dom
  • [ ] Events
  • [ ] Image
  • [ ] IO
  • [ ] Math
  • [ ] Typography
  • [ ] Utilities
  • [ ] WebGL
  • [ ] Other (specify if possible)

Details about the bug:

  • p5.js version: v0.10.2
  • Web browser and version: Google Chrome | 83.0.4103.116聽(Official Build)聽(64-bit)
  • Operating System: MacOS 10.15.5
  • Steps to reproduce this:
function setup() {
  createCanvas(400, 400);
}

function draw() {
  var offset = 0;
  for (var x = 0; x < PI * 2; x += QUARTER_PI) {
     arc(50.0 + offset, 50.0, 50.0, 50.0, x, 2*PI);
     arc(50.0 + offset, 100, 50, 50, x, 2*PI, OPEN);
     arc(50.0 + offset, 150, 50, 50, x, 2*PI, CHORD);
     arc(50.0 + offset, 200, 50, 50, x, 2*PI, PIE);
     offset += 50;
  }
}
bug

All 5 comments

Welcome! 馃憢 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, be sure to follow the issue template if you haven't already.

Thanks to @dzaima, I realized that in my orginal snippet the start angle and end angle are acutally not the same. When I manually set them to a fixed value, I get a full circle instead of nothing:

function setup() {
  createCanvas(400, 400);
}

function draw() {
  arc(50.0, 50.0, 50.0, 50.0, 2*PI, 2 * PI);
  arc(50.0, 100, 50, 50, 0, 0, OPEN);
  arc(50.0, 150, 50, 50, 1, 1, CHORD);
  arc(50.0, 200, 50, 50, 2, 2, PIE);
}

Screen Shot 2020-07-01 at 7 02 52 PM

Does that mean this issue can be closed, or is there still something to resolve?

@jeremydouglass I think the behavior is still inconsistent since I think if the start angle and end angle are the same we should expect nothing to be drawn instead of a full circle :)

A check probably can be added at the beginning of the arc function or the normalize angle function to account for this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

slowizzm picture slowizzm  路  3Comments

stalgiag picture stalgiag  路  3Comments

sps014 picture sps014  路  3Comments

b0nb0n picture b0nb0n  路  3Comments

dhowe picture dhowe  路  3Comments