X-Git-Url: https://git.ao2.it/experiments/RadialSymmetry.git/blobdiff_plain/6f91eff6a3d5b807880f2ced0200cf95b6c694fb..b1560e48352bc9862c8c250717532d6fc03db740:/Diagram.py diff --git a/Diagram.py b/Diagram.py index cb4bde1..e2d85d5 100755 --- a/Diagram.py +++ b/Diagram.py @@ -125,7 +125,7 @@ class Diagram(object): verts = self.get_regular_polygon(cx, cy, sides, r, theta) self.draw_polygon_by_verts(verts, fill_color, stroke_color) - def draw_star(self, cx, cy, verts, stroke_color=[0, 0, 0]): + def draw_star_by_verts(self, cx, cy, verts, stroke_color=[0, 0, 0]): cr = self.cr for v in verts: @@ -136,6 +136,13 @@ class Diagram(object): cr.set_source_rgba(r, g, b, a) cr.stroke() + def draw_star(self, cx, cy, sides, r, theta=0.0, stroke_color=[0, 0, 0]): + apothem = r * cos(pi / sides) + apothem_angle = theta + pi / sides + + verts = self.get_regular_polygon(cx, cy, sides, apothem, apothem_angle) + self.draw_star_by_verts(cx, cy, verts, stroke_color) + def draw_circle(self, cx, cy, size=10.0, fill_color=[0, 0, 0, 0.5], stroke_color=None): cr = self.cr