213 {
214 const std::vector<Segment>
tests[] = {
215 {{{-58, -100}, {75, 105}}, {{149, -58}, {-156, 49}}, {{-34, -55}, {37, 49}}, {{-58, -100}, {75, 105}}, {{-147, -229}, {143, 220}}},
216 {{{-57, -138}, {56, 178}}, {{14, -146}, {-22, 132}}},
217 {{{-4, -23}, {-11, 11}}, {{6, -2}, {-11, 11}}, {{159, -244}, {-159, 233}}},
218 {{{-7, -22}, {10, 14}}, {{-7, -71}, {-7, 80}}, {{-7, -22}, {-4, 5}}},
219 {{{91, -22}, {-93, 24}}, {{31, -18}, {-25, 7}}, {{-25, 7}, {33, 12}}, {{-26, -24}, {18, 20}}},
220 {{{2, -21}, {-16, 7}}, {{-45, -28}, {51, 35}}, {{39, -48}, {-53, 44}}, {{-16, 7}, {26, 7}}},
221 {{{142, -82}, {-128, 64}}, {{208, -16}, {-217, -3}}, {{91, -22}, {-93, 24}}, {{31, -18}, {-25, 7}}, {{-25, 7}, {33, 12}}},
222 {{{-159, -101}, {167, 91}}, {{-96, -117}, {99, 117}}, {{-16, -21}, {12, 35}}, {{-48, -55}, {33, 63}}, {{-16, -21}, {26, 41}}},
223 {{{-51, -18}, {34, 1}}, {{189, -169}, {-171, 150}}, {{24, -8}, {-5, 7}}, {{24, -8}, {-26, 16}}, {{54, -22}, {-36, 20}}},
224 {{{-29, -3}, {15, -3}}, {{-28, -7}, {15, -3}}},
225 {{{20, -149}, {-32, 130}}, {{-29, -3}, {15, -3}}, {{-28, -7}, {15, -3}}},
226 {{{-32, -8}, {16, -8}}, {{-28, -104}, {23, 88}}, {{-17, -11}, {16, -8}}},
227 {{{-59, -9}, {48, 11}}, {{-59, -9}, {75, -9}}, {{173, -20}, {-178, 13}}},
228 {{{-11, 1}, {12, 1}}, {{-42, -35}, {54, 29}}},
229 {{{14, -11}, {-15, -2}}, {{-9, -2}, {13, -2}}},
230 {{{-38, 7}, {47, 7}}, {{-148, 6}, {166, 7}}},
231 {{{-26, -22}, {9, 21}}, {{-32, -28}, {13, 17}}},
232 {{{23, -2}, {-12, 3}}, {{22, -13}, {-5, 2}}},
233 {{{-2, -100}, {-2, 89}}, {{6, -70}, {-2, 72}}},
234 {{{8, -1}, {-8, 19}}, {{-130, -93}, {137, 85}}},
235 {{{-39, -111}, {25, 119}}, {{-26, -112}, {25, 119}}},
236 {{{-9, -5}, {16, -5}}, {{90, -134}, {-71, 144}}},
237 {{{-1, -1}, {1, 1}}, {{1, -1}, {-1, 1}}},
238 {{{-1, -1}, {-1, 1}}, {{1, -1}, {1, 1}}},
239 {{{-1, -1}, {1, -1}}, {{-1, 1}, {1, 1}}},
240 {{{-2, 1}, {1, 1}}, {{-1, 1}, {2, 1}}},
241 {{{0, -100}, {0, -50}}, {{100, -100}, {-100, 100}}},
242 {{{0, 100}, {0, 50}}, {{100, -100}, {-100, 100}}},
243 {{{0, -101}, {0, -50}}, {{100, -100}, {-100, 100}}},
244 {{{0, 0}, {0, 50}}, {{100, -100}, {-100, 100}}},
245 {{{-10, -10}, {10, 10}}, {{-10, -10}, {11, 11}}, {{10, -10}, {-10, 10}}},
246 {{{10, -10}, {-10, 10}}, {{10, -10}, {-11, 11}}, {{-10, -10}, {10, 10}}},
247 {{{-11, -11}, {10, 10}}, {{-10, -10}, {11, 11}}, {{10, -10}, {-10, 10}}},
248 };
249
250 for (
const auto& segments :
tests) {
251 std::vector<Segment> myersSegments = segments;
252 std::vector<Segment> bruteSegments = segments;
255
256 std::sort(myersResponse.begin(), myersResponse.end());
257 std::sort(bruteResponse.begin(), bruteResponse.end());
258
260#if 0
261 if (myersResponse.size() != bruteResponse.size()) {
263 }
264#endif
265
267 std::unique(myersResponse.begin(), myersResponse.end()) ==
268 myersResponse.end());
270 std::unique(bruteResponse.begin(), bruteResponse.end()) ==
271 bruteResponse.end());
272
273
275 bruteResponse.begin(), bruteResponse.end()));
276 }
277}
static bool equal(const SkBitmap &a, const SkBitmap &b)
static std::vector< SkPDFIndirectReference > sort(const THashSet< SkPDFIndirectReference > &src)
std::optional< std::vector< Crossing > > brute_force_crossings(SkSpan< const Segment > segments)
std::vector< Crossing > myers_find_crossings(const SkSpan< const Segment > segments)