8 import fields2cover
as f2c
11 assert pytest.approx(a) == pytest.approx(b)
16 swaths = f2c.Swaths();
18 swaths.push_back(f2c.Swath(f2c.LineString(f2c.VectorPoint( \
19 [f2c.Point(i, 0), f2c.Point(i, 1)])), i, i));
21 swath_sorter = f2c.RP_Boustrophedon();
22 objective = f2c.OBJ_DirectDistPathObj();
24 swaths = swath_sorter.genSortedSwaths(swaths);
25 near(swaths.size(), n - 1);
26 near(swaths[0].startPoint().getY(), 0);
28 near(swaths[i - 1].getWidth(), i);
29 near(objective.computeCost(swaths), 2*(n-1)-1);
30 swaths = swath_sorter.genSortedSwaths(swaths, 1);
31 near(swaths[0].startPoint().getY(), 0);
32 near(swaths[0].getWidth(), n-1);
33 near(swaths[1].getWidth(), n-2);
34 near(swaths[2].getWidth(), n-3);
35 near(objective.computeCost(swaths), 2*(n-1)-1);
36 swaths = swath_sorter.genSortedSwaths(swaths, 2);
37 near(swaths[0].startPoint().getY(), 1);
38 near(swaths[0].getWidth(), 1);
39 near(swaths[1].getWidth(), 2);
40 near(swaths[2].getWidth(), 3);
41 near(objective.computeCost(swaths), 2*(n-1)-1);
42 swaths = swath_sorter.genSortedSwaths(swaths, 3);
43 near(swaths[0].startPoint().getY(), 1);
44 near(swaths[0].getWidth(), n-1);
45 near(swaths[1].getWidth(), n-2);
46 near(swaths[2].getWidth(), n-3);
47 near(objective.computeCost(swaths), 2*(n-1)-1);