8 import fields2cover
as f2c
11 assert pytest.approx(a) == pytest.approx(b)
17 swaths = f2c.Swaths();
19 swaths.push_back(f2c.Swath(f2c.LineString(f2c.VectorPoint( \
20 [f2c.Point(0, i), f2c.Point(1, i)])), i, i));
22 swath_order = f2c.RP_Spiral(size);
23 swaths = swath_order.genSortedSwaths(swaths);
25 near(swaths[0].getWidth(), 1);
26 near(swaths[1].getWidth(), 6);
27 near(swaths[2].getWidth(), 2);
28 near(swaths[3].getWidth(), 5);
29 near(swaths[4].getWidth(), 3);
30 near(swaths[5].getWidth(), 4);
31 near(swaths[6].getWidth(), 7);
32 near(swaths[7].getWidth(), 10);
33 near(swaths[8].getWidth(), 8);
34 near(swaths[9].getWidth(), 9);
39 swaths = f2c.Swaths();
41 swaths.push_back(f2c.Swath(f2c.LineString(f2c.VectorPoint( \
42 [f2c.Point(0, i), f2c.Point(1, i)])), i, i));
44 swath_sorter = f2c.RP_Spiral(size);
45 swaths = swath_sorter.genSortedSwaths(swaths);
47 near(swaths[0].getWidth(), 1);
48 near(swaths[1].getWidth(), 5);
49 near(swaths[2].getWidth(), 2);
50 near(swaths[3].getWidth(), 4);
51 near(swaths[4].getWidth(), 3);
52 near(swaths[5].getWidth(), 10);
53 near(swaths[6].getWidth(), 6);
54 near(swaths[7].getWidth(), 9);
55 near(swaths[8].getWidth(), 7);
56 near(swaths[9].getWidth(), 8);
61 swaths = f2c.Swaths();
63 swaths.push_back(f2c.Swath(f2c.LineString(f2c.VectorPoint( \
64 [f2c.Point(0, i), f2c.Point(1, i)])), i, i));
66 swath_sorter = f2c.RP_Spiral();
67 swath_sorter.setSpiralSize(size);
69 swaths = swath_sorter.genSortedSwaths(swaths);
71 near(swaths[0].getWidth(), 1);
72 near(swaths[1].getWidth(), 6);
73 near(swaths[2].getWidth(), 2);
74 near(swaths[3].getWidth(), 5);
75 near(swaths[4].getWidth(), 3);
76 near(swaths[5].getWidth(), 4);
77 near(swaths[6].getWidth(), 7);
78 near(swaths[7].getWidth(), 10);
79 near(swaths[8].getWidth(), 8);
80 near(swaths[9].getWidth(), 9);
85 swaths = f2c.Swaths();
87 swaths.push_back(f2c.Swath(f2c.LineString(f2c.VectorPoint( \
88 [f2c.Point(0, i), f2c.Point(1, i)])), i, i));
90 swath_sorter = f2c.RP_Spiral();
91 swath_sorter.setSpiralSize(size);
93 swaths = swath_sorter.genSortedSwaths(swaths);
95 near(swaths[0].getWidth(), 1);
96 near(swaths[1].getWidth(), 5);
97 near(swaths[2].getWidth(), 2);
98 near(swaths[3].getWidth(), 4);
99 near(swaths[4].getWidth(), 3);
100 near(swaths[5].getWidth(), 10);
101 near(swaths[6].getWidth(), 6);
102 near(swaths[7].getWidth(), 9);
103 near(swaths[8].getWidth(), 7);
104 near(swaths[9].getWidth(), 8);
108 swaths = f2c.Swaths();
109 for i
in range(1, n):
110 swaths.push_back(f2c.Swath(f2c.LineString(f2c.VectorPoint( \
111 [f2c.Point(0, i), f2c.Point(1, i)])), i, i));
113 swath_sorter = f2c.RP_Spiral();
114 swaths = swath_sorter.genSortedSwaths(swaths);
116 near(swaths[0].getWidth(), 1);
117 near(swaths[1].getWidth(), 2);
118 near(swaths[2].getWidth(), 3);
119 near(swaths[3].getWidth(), 4);
120 near(swaths[4].getWidth(), 5);
121 near(swaths[5].getWidth(), 6);
122 near(swaths[6].getWidth(), 7);
123 near(swaths[7].getWidth(), 8);
124 near(swaths[8].getWidth(), 9);
125 near(swaths[9].getWidth(), 10);
129 swaths = f2c.Swaths();
130 for i
in range(1, n):
131 swaths.push_back(f2c.Swath(f2c.LineString(f2c.VectorPoint( \
132 [f2c.Point(0, i), f2c.Point(1, i)])), i, i));
134 swath_sorter = f2c.RP_Spiral();
136 swaths = swath_sorter.genSortedSwaths(swaths);
138 near(swaths[0].getWidth(), 1);
139 near(swaths[1].getWidth(), 2);
140 near(swaths[2].getWidth(), 3);
141 near(swaths[3].getWidth(), 4);
142 near(swaths[4].getWidth(), 5);
143 near(swaths[5].getWidth(), 6);
144 near(swaths[6].getWidth(), 7);
145 near(swaths[7].getWidth(), 8);
146 near(swaths[8].getWidth(), 9);
147 near(swaths[9].getWidth(), 10);