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
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
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)
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)
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)