From c2ab70eefefcccf826c5264eccfcd2fed86b02e6 Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Wed, 22 Mar 2017 21:56:50 +0100 Subject: [PATCH] Add Boxes.circle() primitive --- boxes/__init__.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/boxes/__init__.py b/boxes/__init__.py index da55c6f..4e3f06c 100755 --- a/boxes/__init__.py +++ b/boxes/__init__.py @@ -877,6 +877,26 @@ class Boxes: self.moveTo(self.spacing / 2.0, self.spacing / 2.0) return dontdraw + @restore + def circle(self, x, y, r): + """ + Draw a round disc + + :param x: position + :param y: postion + :param r: radius + + """ + r += self.burn + self.moveTo(x + r, y) + a = 0 + n = 10 + da = 2 * math.pi / n + for i in range(n): + self.ctx.arc(-r, 0, r, a, a+da) + a += da + self.ctx.stroke() + @restore @holeCol def hole(self, x, y, r):