Skip to content

Commit

Permalink
Fixed arc() not filling the last half degree [#1717]
Browse files Browse the repository at this point in the history
Conflicts:
	test/ref/tests.js
  • Loading branch information
jbuck committed Oct 12, 2011
2 parents 7149be8 + 2996604 commit 436fe31
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
23 changes: 8 additions & 15 deletions processing.js
Expand Up @@ -13347,20 +13347,18 @@
var vr = height / 2;
var centerX = x + hr;
var centerY = y + vr;
var startLUT = 0 | (-0.5 + (start / PConstants.TWO_PI) * PConstants.SINCOS_LENGTH);
var stopLUT = 0 | (0.5 + (stop / PConstants.TWO_PI) * PConstants.SINCOS_LENGTH);
var startLUT = 0 | (-0.5 + start * p.RAD_TO_DEG * 2);
var stopLUT = 0 | (0.5 + stop * p.RAD_TO_DEG * 2);
var i, j;
if (doFill) {
// shut off stroke for a minute
var savedStroke = doStroke;
doStroke = false;
p.beginShape();
p.vertex(centerX, centerY);
for (i = startLUT, j = startLUT; i < stopLUT; i++, j++) {
if (j >= PConstants.SINCOS_LENGTH) {
j = j - PConstants.SINCOS_LENGTH;
}
p.vertex(centerX + cosLUT[j] * hr,centerY + sinLUT[j] * vr);
for (i = startLUT; i <= stopLUT; i++) {
j = i % PConstants.SINCOS_LENGTH;
p.vertex(centerX + cosLUT[j] * hr, centerY + sinLUT[j] * vr);
}
p.endShape(PConstants.CLOSE);
doStroke = savedStroke;
Expand All @@ -13371,15 +13369,10 @@
var savedFill = doFill;
doFill = false;
p.beginShape();
for (i = startLUT, j = startLUT; i < stopLUT; i++, j++) {
if (j >= PConstants.SINCOS_LENGTH) {
j = j - PConstants.SINCOS_LENGTH;
}
p.vertex(centerX + cosLUT[j] * hr,centerY + sinLUT[j] * vr);
for (i = startLUT; i <= stopLUT; i++) {
j = i % PConstants.SINCOS_LENGTH;
p.vertex(centerX + cosLUT[j] * hr, centerY + sinLUT[j] * vr);
}
// explicitly add the last vertex, for precision
j = stopLUT % PConstants.SINCOS_LENGTH;
p.vertex(centerX + cosLUT[j] * hr,centerY + sinLUT[j] * vr);
p.endShape();
doFill = savedFill;
}
Expand Down
6 changes: 6 additions & 0 deletions test/ref/arc-fill-crisp.pde

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions test/ref/tests.js
@@ -1,5 +1,6 @@
var tests = [
{ path: "stretch.pde", tags: ["3D"] },
{ path: "arc-fill-crisp.pde", tags: ["2D"], epsilonOverride: 0.07 },
{ path: "tint-isImageDirty.pde", tags: ["2D"] },
{ path: "copy-no-source.pde", tags: ["2D", "BLEND"] },
{ path: "pgraphics-get-3d.pde", tags: ["3D"] },
Expand Down

0 comments on commit 436fe31

Please sign in to comment.