Add Boxes.circle() primitive

This commit is contained in:
Florian Festi 2017-03-22 21:56:50 +01:00
parent 71bd013f3f
commit c2ab70eefe
1 changed files with 20 additions and 0 deletions

View File

@ -877,6 +877,26 @@ class Boxes:
self.moveTo(self.spacing / 2.0, self.spacing / 2.0) self.moveTo(self.spacing / 2.0, self.spacing / 2.0)
return dontdraw 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 @restore
@holeCol @holeCol
def hole(self, x, y, r): def hole(self, x, y, r):