PistonDevelopers/graphics

with_arc_tri_list is very imprecise

Closed this issue · 1 comments

The way that resolution is used now implies that the angle included in a drawn arc segment in often quite incorrect. If the included angle of the arc doesn't neatly divide into 2pi / resolution, the drawn angle can be off by as much as a factor of two.

If the PR would be welcome, I can improve this implementation to aim at precisely hitting the start and end angles while using approximately as many triangles as the current impl.

This screengrab shows the bug. http://imgur.com/a/xOUea

All of those circles should be completely full, like the white and the blue. They look perfect because they are 64 and 128 segments, respectively, which divide nicely into the default resolution of 128. The green is drawn with 65 segments; at default resolution each arc should be just shy of 2pi/128, but since the algorithm builds in chunks of 2pi/128 the drawn arc has nearly half the included angle that it should.