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(0, i), f2c.Point(1, i)])), i, i));
21 swath_sorter = f2c.RP_Snake();
22 objective = f2c.OBJ_DirectDistPathObj();
24 swaths = swath_sorter.genSortedSwaths(swaths, 0);
26 near(swaths[0].getWidth(), 1);
27 near(swaths[1].getWidth(), 3);
28 near(swaths[2].getWidth(), 5);
29 near(swaths.back().getWidth(), 2);
31 near(objective.computeCost(swaths), 3*((n-1)-1));
36 swaths = f2c.Swaths();
38 swaths.push_back(f2c.Swath(f2c.LineString(f2c.VectorPoint( \
39 [f2c.Point(0, i), f2c.Point(1, i)])), i, i));
41 swath_sorter = f2c.RP_Snake();
42 objective = f2c.OBJ_DirectDistPathObj();
44 swaths = swath_sorter.genSortedSwaths(swaths, 0);
46 near(swaths[0].getWidth(), 1);
47 near(swaths[1].getWidth(), 3);
48 near(swaths[2].getWidth(), 5);
49 near(swaths.back().getWidth(), 2);
50 near(objective.computeCost(swaths), 3*((n-1)-1));