40 Segment interesting[] = {{Point::Smallest(), Point::Smallest()+
Point{10, 5}},
41 {Point::Largest(), Point::Largest() -
Point{10, 5}},
42 {{-10, -5}, {10, 5}}};
45 for (
auto& s0 : interesting) {
46 auto [l, t, r,
b] = s0.bounds();
63 int32_t small = Point::Smallest().x,
64 big = Point::Largest().x;
67 for (
auto& s0 : interesting) {
68 auto [l, t, r,
b] = s0.bounds();
70 Segment outside[] = {{{r, t}, {big,
b}},
73 {{l,
b}, {small, big}},
75 {{l, t}, {small, small}},
77 {{r, t}, {small, small}}};
79 for (
auto& s1 : outside) {
116 Segment s0 = {{-1, 0}, {1, 0}},
117 s1 = {{ 0, 1}, {0, -1}};
119 checkIntersection(s0, s1,
Point{0, 0});
122 Segment s0 = {{-1, 0}, {5, 0}},
123 s1 = {{ 0, 1}, {0, -1}};
125 checkIntersection(s0, s1,
Point{0, 0});
129 Segment s0 = {{5, 0}, {-1, 0}},
130 s1 = {{ 0, -1}, {0, 1}};
132 checkIntersection(s0, s1,
Point{0, 0});
136 Segment s0 = {{-5, -5}, {5, 5}},
137 s1 = {{-5, 5}, {5, -5}};
139 checkIntersection(s0, s1,
Point{0, 0});
143 for (int32_t x0 = -10; x0 <= 10; x0++) {
144 for (int32_t x1 = -10; x1 <= 10; x1++) {
145 for (int32_t x2 = -10; x2 <= 10; x2++) {
146 for (int32_t x3 = -10; x3 <= 10; x3++) {
151 auto actual =
intersect({P0, P1}, {P2, P3});
152 bool expected = (x0 < x2 && x3 < x1) || (x2 < x0 && x1 < x3);
164 Segment s0 = {{0, -100}, {0, -50}},
165 s1 = {{100, -100}, {-100, 100}};
172 Segment s0 = {{0, 100}, {0, 50}},
173 s1 = {{100, -100}, {-100, 100}};
183 Segment s0 = {{-1, 1}, {-1, -1}},
184 s1 = {{1, 1}, {1, -1}};
194 Segment s0 = {{-1, -1}, {1, 1}},
195 s1 = {{1, -1}, {-1, 1}};
208 Segment s0 = {{0, -100}, {0, 100}},
209 s1 = {{-3, 98}, {3, 104}};
224 Segment s0 = {{-1, 1}, {0, 1}},
225 s1 = {{-2, 1}, {1, 1}};
230 Segment s0 = {{-1, 1}, {0, 0}},
231 s1 = {{-2, 1}, {1, 1}};
236 Segment s0 = {{-1, 1}, {-1, 0}},
237 s1 = {{-2, 1}, {-1, 0}},
238 s2 = {{2, 1}, {-1, 0}};
246 Segment s0 = {{-2, 1}, {0, 0}},
247 s1 = {{-4, 2}, {0, 0}};
254 s1 = {{4, 2}, {0, 0}};
260 Segment s0 = {{-2, 1}, {0, 0}},
261 s1 = {{4, 2}, {0, 0}};
267 Segment s0 = {{-2, 1}, {0, 0}},
268 s1 = {{-3, 1}, {0, 0}};
290 Segment s = {{-100, -100}, {100, 100}};
296 Segment s = {{-100, -100}, {199, 200}};
302 Segment s = {{-100, -100}, {201, 200}};
325 Segment s = {{-100, -100}, {100, 100}};
331 Segment s = {{-100, -100}, {199, 200}};
337 Segment s = {{-100, -100}, {201, 200}};
static bool intersect(const SkPoint &p0, const SkPoint &n0, const SkPoint &p1, const SkPoint &n1, SkScalar *t)
DEF_TEST(BO_SegmentBasic, reporter)
static Segment swap_ends(const Segment &s)
#define REPORTER_ASSERT(r, cond,...)
bool rounded_point_less_than_segment_in_x_lower(const Segment &s, Point p)
bool rounded_point_less_than_segment_in_x_upper(const Segment &s, Point p)
bool no_intersection_by_bounding_box(const Segment &s0, const Segment &s1)
int compare_slopes(const Segment &s0, const Segment &s1)
bool less_than_at(const Segment &s0, const Segment &s1, int32_t y)
SIN Vec< N, float > abs(const Vec< N, float > &x)