Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class MyImageDraw(ImageDraw):
- def regular_polygon(self, center_coords, sides, radius, rotation=0, fill=None,
- outline=None):
- dots = []
- angle = 0 - rotation
- while angle < 2 * pi - rotation:
- dots.append((int(-sin(angle) * radius + center_coords[0]),
- int(cos(angle) * radius + center_coords[1])))
- angle += 2 * pi / sides
- self.polygon((*dots,), fill, outline)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement