PistonDevelopers / graphics

A library for 2D graphics, written in Rust, that works with multiple back-ends
MIT License
479 stars 55 forks source link

Numeric inaccuracy when drawing a full circle with `circle_arc` #1146

Closed bvssvni closed 3 years ago

bvssvni commented 3 years ago

A report on Discord channel that that the circle_arc is missing a tiny sliver when drawing a full circle. Increasing the angle with an infinitesimal fixes the error.

nashimus commented 3 years ago

Here is the change that I used to work around this:

@@ -148,7 +148,7 @@ impl Game {
                             self.player2_color,
                             o_thickness,
                             0.0,
-                            6.28,
+                                std::f64::consts::PI * 2.0 - 0.00001,
                             [
                                 shape_x + (self.cell_width * o_scaling_factor / 12.0),
                                 shape_y + (self.cell_height * o_scaling_factor / 12.0),
bvssvni commented 3 years ago

Closed by https://github.com/PistonDevelopers/graphics/issues/1147