Beispiel #1
0
 def _future_coords(self, rotation, target_d):
     d = self.actual_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
Beispiel #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
Beispiel #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)
Beispiel #4
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)
Beispiel #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)
Beispiel #6
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)