Exemplo n.º 1
0
 def draw(self):
     #rotate vertices,convert to x-y format
     cartesian_points = [
         pc.to_cartesian([r, theta + self.rotation_angle])
         for [r, theta] in self.points
     ]
     self.screen_points = [[int(self.x + pt[0]),
                            int(self.y + pt[1])] for pt in cartesian_points]
Exemplo n.º 2
0
    def __init__(self, size=50):

        self.x, self.y = randint(0, width), randint(0, height)
        self.size = size
        self.level = 1
        self.sides = randint(6, 9)
        self.heading = uniform(0.0, 2 * pi)
        self.points = [pc.to_cartesian((uniform(0.5*self.size,
                                             1.0*self.size),
                                     2*pi*i/self.sides)) \
                       for i in range(self.sides)]
        self.screen_points = [[self.x + pt[0], self.y + pt[1]]
                              for pt in self.points]