コード例 #1
0
ファイル: objects.py プロジェクト: manfreddiaz/multigym
    def render(self, img):
        tri_fn = rendering.point_in_triangle(
            (0.12, 0.19),
            (0.87, 0.50),
            (0.12, 0.81),
        )

        # Rotate the agent based on its direction
        tri_fn = rendering.rotate_fn(tri_fn,
                                     cx=0.5,
                                     cy=0.5,
                                     theta=0.5 * math.pi * self.dir)
        c = minigrid.COLORS[self.team.color]
        rendering.fill_coords(img, tri_fn, c)

        if self.is_holding:
            c = minigrid.COLORS[self._holding.team.color]
            # Vertical quad
            post = minigrid.point_in_rect(0.20, 0.25, 0.20, 0.45)
            post = minigrid.rotate_fn(post,
                                      cx=0.5,
                                      cy=0.5,
                                      theta=0.5 * np.pi * (self.dir))
            minigrid.fill_coords(img, post, c)

            flag = minigrid.point_in_triangle(
                (0.20, 0.20),
                (0.20, 0.10),
                (0.40, 0.15),
            )
            flag = minigrid.rotate_fn(flag,
                                      cx=0.5,
                                      cy=0.5,
                                      theta=0.5 * np.pi * (self.dir))
            minigrid.fill_coords(img, flag, c)
コード例 #2
0
 def render(self, img):
     tri_fn = point_in_triangle(
         (0.12, 0.19),
         (0.87, 0.50),
         (0.12, 0.81),
     )
     tri_fn = rotate_fn(tri_fn, cx=0.5, cy=0.5, theta=0.5 * np.pi * (self.dir))
     fill_coords(img, tri_fn, COLORS[self.color])
コード例 #3
0
ファイル: multigrid.py プロジェクト: manfreddiaz/multigym
  def render(self, img):
    tri_fn = rendering.point_in_triangle(
        (0.12, 0.19),
        (0.87, 0.50),
        (0.12, 0.81),
    )

    # Rotate the agent based on its direction
    tri_fn = rendering.rotate_fn(
        tri_fn, cx=0.5, cy=0.5, theta=0.5 * math.pi * self.dir)
    color = AGENT_COLOURS[self.agent_id]
    rendering.fill_coords(img, tri_fn, color)