26 auto [l, r] = std::minmax(
p0.
x,
p1.
x);
27 auto [t,
b] = std::minmax(
p0.
y,
p1.
y);
28 return std::make_tuple(l, t, r,
b);
40 auto [left0, top0, right0, bottom0] = s0.
bounds();
41 auto [left1, top1, right1, bottom1] = s1.
bounds();
43 return right0 <= left1 || right1 <= left0 || bottom0 <= top1 || bottom1 <= top0;
110 if (P0 == P2 || P1 == P3 || P1 == P2 || P3 == P0) {
126 return x0 * y1 - y0 * x1;
130 const int64_t QxR =
cross(
Q,
R),
140 if ((QxR ^ TxQ) < 0 || (TxR ^ TxQ) < 0) {
146 if (QxR > TxQ || TxR > TxQ) {
151 if (QxR < TxQ || TxR < TxQ) {
160 const double t =
static_cast<double>(QxR) /
static_cast<double>(TxQ);
162 const int32_t
x =
std::round(t * (P3.x - P2.x) + P2.x),
179 auto [l0, t0, r0, b0] = s0.
bounds();
180 auto [l1, t1, r1, b1] = s1.
bounds();
196 auto [x0, y0] = s0.
upper();
197 auto [x1, y1] = s0.
lower();
198 auto [x2, y2] = s1.
upper();
199 auto [x3, y3] = s1.
lower();
201 int64_t s0YDiff =
y - y0,
205 x0Offset = x0 * s0YDelta + s0YDiff * (x1 - x0),
206 x2Offset = x2 * s1YDelta + s1YDiff * (x3 - x2);
209 s1Factor =
multiply(x2Offset, y1 - y0);
211 return s0Factor < s1Factor;
215 auto [l, t, r,
b] = segment.
bounds();
223 }
else if (
p.x >= r) {
227 auto [x0, y0] = segment.
upper();
228 auto [x1, y1] = segment.
lower();
249 const auto [l, t, r,
b] =
s.bounds();
250 const auto [
x,
y] =
p;
265 const auto [x0, y0] =
s.upper();
266 const auto [x1, y1] =
s.lower();
291 const auto [l, t, r,
b] =
s.bounds();
292 const auto [
x,
y] =
p;
307 const auto [x0, y0] =
s.upper();
308 const auto [x1, y1] =
s.lower();
334 if (s0Delta.
y == 0 || s1Delta.y == 0) {
335 if (s0Delta.
y != 0) {
337 }
else if (s1Delta.y != 0) {
356 }
else if (lhs > rhs) {
static void round(SkPoint *p)
constexpr int64_t SkToS64(S x)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
bool point_less_than_segment_in_x(Point p, const Segment &segment)
bool operator<(const Int96 &a, const Int96 &b)
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)
std::optional< Point > intersect(const Segment &s0, const Segment &s1)
int compare_slopes(const Segment &s0, const Segment &s1)
Int96 multiply(int64_t a, int32_t b)
bool operator==(const Int96 &a, const Int96 &b)
bool less_than_at(const Segment &s0, const Segment &s1, int32_t y)
int64_t cross(Point d0, Point d1)
std::tuple< int32_t, int32_t, int32_t, int32_t > bounds() const