def test_convert_in_motion_simple(self, init_controller):
     # --given--
     nav, robot, *_ = init_controller
     positions = [(0, 0), (1, 1)]
     # --when--
     motions = nav.to_translations(list(Point.new(xy) for xy in positions))
     # --then--
     assert len(motions) == 1
示例#2
0
    def test_simple_rotation(self, points, size, indices_on_spot, indices_simple):
        motions = self.__class__.to_translation(list(Point.new(xy) for xy in points))

        arranger = CurveArranger()
        arranged_motions = arranger.arrange(motions)

        assert(len(arranged_motions)) == size

        on_the_spot_positions = get_on_the_spot_indices(arranged_motions)
        simple_rotation_positions = get_simple_rotations_indices(arranged_motions)

        assert on_the_spot_positions == indices_on_spot
        assert simple_rotation_positions == indices_simple
示例#3
0
    def test_base(self):
        points = [(0,0), (0,5),(1,8),(3,9),(5,8), (7,5), (6,0),(0,0)]
        motions = self.__class__.to_translation(list(Point.new(xy) for xy in points))
        # -- when --
        arranger = CurveArranger()
        arranged_motions = arranger.arrange(motions)

        assert (any(isinstance(t, Rotation) for t in arranged_motions))

        on_the_spot_positions = get_on_the_spot_indices(arranged_motions)
        simple_rotation_positions = get_simple_rotations_indices(arranged_motions)

        assert on_the_spot_positions == [4, 9]
        assert simple_rotation_positions == [2,7]
示例#4
0
 def to_points(self, positions):
     return list([Point.new(xy) for xy in positions])
 def test_move_creation(self):
     m = Translation(Point.new((0, 0)), Point.new((1, 1)))
     assert m.start == Point.new((0, 0))
     assert m.end == Point.new((1, 1))
     assert m.length == math.sqrt(2)
     assert m.vector == Point(math.sqrt(1 / 2), math.sqrt(1 / 2))
 def convert(positions):
     return list(Point.new(xy) for xy in positions)