def _get_closest_island_distance(self, action): next_move_segment = Segment(self._world_map.robot.get_center(), action.destination) closest_island = self._get_closest_island_from_segment( next_move_segment) if closest_island is None: return None return next_move_segment.distance( closest_island.get_center()) - closest_island.get_size() / 2
def base(self): left_point = Vector2(self.center.x - self.size.width / 2, self.center.y + self.size.height / 2) right_point = Vector2(self.center.x + self.size.width / 2, self.center.y + self.size.height / 2) upright_base = Segment(left_point, right_point) return upright_base.rotate_center(self.center, self.angle)