Exemplo n.º 1
0
 def _future_coords(self, rotation, target_d):
     d = self.speed * VIRTUAL_TIME_INTERVAL / 1000
     if rotation == 0:
         d = min(d, target_d) # stop before colliding target
     a = self.o + rotation
     x = self.x + d * int_cos_1000(a) / 1000
     y = self.y + d * int_sin_1000(a) / 1000
     return x, y
Exemplo n.º 2
0
 def _future_coords(self, rotation, target_d):
     d = self.speed * VIRTUAL_TIME_INTERVAL / 1000
     if rotation == 0:
         d = min(d, target_d)  # stop before colliding target
     a = self.o + rotation
     x = self.x + d * int_cos_1000(a) / 1000
     y = self.y + d * int_sin_1000(a) / 1000
     return x, y
Exemplo n.º 3
0
 def be_used_by(self, actor):
     actor.move_to(
         self.other_side.place,
         self.other_side.x +
         250 * int_cos_1000(self.other_side.o) / 1000,  # 25 cm
         self.other_side.y +
         250 * int_sin_1000(self.other_side.o) / 1000,  # 25 cm
         self.other_side.o,
         self,
         self.other_side)
Exemplo n.º 4
0
 def _future_coords(self, rotation, dmax):
     # XXX: assertion: self.o points to the target
     if rotation == 0:
         d = min(self._d, dmax) # stop before colliding target
     else:
         d = self._d
     a = self.o + rotation
     x = self.x + d * int_cos_1000(a) / 1000
     y = self.y + d * int_sin_1000(a) / 1000
     return x, y
Exemplo n.º 5
0
 def arrange_resources_symmetrically(self, xc, yc):
     square_width = self.xmax - self.xmin
     nb = len(self.objects)
     shift = self._shift(xc, yc)
     for i, o in enumerate(self.objects):
         x = self.x
         y = self.y
         if nb > 1:
             a = 360 * i / nb + shift
             # it is possible to add a constant to this angle and keep
             # the symmetry
             x += square_width * 35 / 100 * int_cos_1000(a) / 1000
             y += square_width * 35 / 100 * int_sin_1000(a) / 1000
         o.move_to(o.place, x, y)
Exemplo n.º 6
0
 def arrange_resources_symmetrically(self, xc, yc):
     square_width = self.xmax - self.xmin
     nb = len(self.objects)
     shift = self._shift(xc, yc)
     for i, o in enumerate(self.objects):
         x = self.x
         y = self.y
         if nb > 1:
             a = 360 * i / nb + shift
             # it is possible to add a constant to this angle and keep
             # the symmetry
             x += square_width * 35 / 100 * int_cos_1000(a) / 1000
             y += square_width * 35 / 100 * int_sin_1000(a) / 1000
         o.move_to(o.place, x, y)
Exemplo n.º 7
0
 def be_used_by(self, actor):
     actor.move_to(self.other_side.place,
                   self.other_side.x + 250 * int_cos_1000(self.other_side.o) / 1000, # 25 cm
                   self.other_side.y + 250 * int_sin_1000(self.other_side.o) / 1000, # 25 cm
                   self.other_side.o,
                   self, self.other_side)