def __render_arc(self, p1: Point, p2: Point, colour: Colour):
        center = p1
        radius = 1

        dir = p2.to_tensor() - p1.to_tensor()
        angle = torch.atan2(dir[1], dir[0])
        angle %= 2 * np.pi

        self.get_renderer_view().draw_arc(center,
                                          angle,
                                          radius=radius,
                                          colour=colour)
Ejemplo n.º 2
0
    def _get_new_vertex(self, q_near: Vertex, q_sample: Point, max_dist) -> Vertex:
        dir = q_sample.to_tensor() - q_near.position.to_tensor()
        if torch.norm(dir) <= max_dist:
            return Vertex(q_sample)

        dir_normalized = dir / torch.norm(dir)
        q_new = Point.from_tensor(q_near.position.to_tensor() + max_dist * dir_normalized)
        return Vertex(q_new)