small ellipses with heavy stroke renders light stroke. bug?

drawing small ellipses with a heavy stroke renders the ellipse in a light stroke. is this a bug or am I doing something wrong?

here is demonstration code:

size(100, 220);

strokeWeight(10);

ellipse(30,  20,  1,  1);
ellipse(30,  40,  2,  2);
ellipse(30,  60,  5,  5);
ellipse(30,  90, 10, 10);
ellipse(30, 120, 11, 11);
ellipse(30, 150, 15, 15);
ellipse(30, 190, 20, 20);

rectMode(CENTER);

rect(70,  20,  1,  1);
rect(70,  40,  2,  2);
rect(70,  60,  5,  5);
rect(70,  90, 10, 10);
rect(70, 120, 11, 11);
rect(70, 150, 15, 15);
rect(70, 190, 20, 20);

result:

processingsmallellipsebug

tested on processing 3 and processing 2 on arch linux.

Answers

  • Look like the stroke is drawn 5 pixels either side of the circumference (which is why the last three look right) so drawing a 10 unit stroke on a 1 unit diameter ellipse is not going to work - the code is probably just bailing once it realises this. Why not work around by drawing a small light ellipse over a larger dark one. I haven't tested it but I wouldn't be surprised if was also quicker on reasonably sized ellipses. :D

Sign In or Register to comment.