def draw(self, temp_color=None):
     """Return svg object for this item."""
     if temp_color:
         color = temp_color
     else:
         color = self.settings["colors"][self.obj_type]
     return svg.Circle(self.position + Point2(10, 10), self.radius, color=color)
    def to_html(self, info=[]):
        """Visualize"""
        info = info[:]
        info.append("Reward = %.1f" % self.collect_reward())
        joint1, joint2 = self.joint_positions()

        total_length = self.params['l1_m'] + self.params['l2_m']
        # 9 / 10 th of half the screen width
        total_length_px = (8. / 10.) * (min(self.size) / 2.)
        scaling_ratio = total_length_px / total_length
        center = (self.size[0] / 2, self.size[1] / 2)

        def transform(point):
            """Transforms from state reference world
            to screen and pixels reference world"""

            x = center[0] + scaling_ratio * point[0]
            y = center[1] + scaling_ratio * point[1]
            return int(x), int(y)

        scene = svg.Scene(
            (self.size[0] + 20, self.size[1] + 20 + 20 * len(info)))
        scene.add(svg.Rectangle((10, 10), self.size))

        joint1 = transform(joint1)
        joint2 = transform(joint2)
        scene.add(svg.Line(center, joint1))
        scene.add(svg.Line(joint1, joint2))

        scene.add(svg.Circle(center, 5, color='red'))
        scene.add(svg.Circle(joint1, 3, color='blue'))
        scene.add(svg.Circle(joint2, 3, color='green'))

        offset = self.size[1] + 15
        for txt in info:
            scene.add(svg.Text((10, offset + 20), txt, 15))
            offset += 20
        return scene
 def draw(self):
     """Return svg object for this item."""
     color = self.settings["colors"][self.obj_type]
     return svg.Circle(self.position + Point2(10, 10),
                       self.radius,
                       color=color)