25 double dot00 = v0.
dot(v0);
26 double dot01 = v0.
dot(v1);
27 double dot02 = v0.
dot(
v2);
28 double dot11 = v1.
dot(v1);
29 double dot12 = v1.
dot(
v2);
31 double denom = dot00 * dot11 - dot01 * dot01;
32 double u = dot11 * dot02 - dot01 * dot12;
33 double v = dot00 * dot12 - dot01 * dot02;
36 return u >= 0 && v >= 0 && u + v < denom;
38 return u <= 0 && v <= 0 && u + v > denom;
55 for (
int oddMan = 0; oddMan <
kPointCount; ++oddMan) {
58 double origX = endPt[0]->
fX;
59 double origY = endPt[0]->
fY;
60 double adj = endPt[1]->
fX - origX;
61 double opp = endPt[1]->
fY - origY;
62 double sign = (
fPts[oddMan].
fY - origY) * adj - (
fPts[oddMan].fX - origX) * opp;
67 bool foundOutlier =
false;
69 double test = (q2[n].fY - origY) * adj - (q2[n].fX - origX) * opp;
92 return conic.hullIntersects(*
this,
isLinear);
96 return cubic.hullIntersects(*
this,
isLinear);
110 int end = (oddMan ^ opp) - oddMan;
118 for (
int index = 0; index < realRoots; ++index) {
119 double tValue =
s[index];
126 for (
int idx2 = 0; idx2 < foundRoots; ++idx2) {
131 t[foundRoots++] = tValue;
173 const double p =
B / (2 *
A);
174 const double q =
C /
A;
179 const double p2 = p * p;
185 sqrt_D = sqrt(p2 - q);
198 double tiniest = std::min(std::min(std::min(std::min(std::min(
fPts[0].fX,
fPts[0].fY),
200 double largest = std::max(std::max(std::max(std::max(std::max(
fPts[0].fX,
fPts[0].fY),
202 largest = std::max(largest, -tiniest);
208 double b = 1 - 2 * t;
231 double one_t = 1 - t;
232 double a = one_t * one_t;
233 double b = 2 * one_t * t;
248 double bc =
SkDInterp(src[2], src[4], t);
286 if (0 == t1 && 1 == t2) {
296 dst[1].fX = 2 * dx - (
ax + cx) / 2;
297 dst[1].fY = 2 * dy - (ay + cy) / 2;
302 if (
fPts[endIndex].fX ==
fPts[1].fX) {
305 if (
fPts[endIndex].fY ==
fPts[1].fY) {
314 SkDLine b0 = {{
a, sub[1] + (
a - sub[0])}};
315 SkDLine b1 = {{c, sub[1] + (c - sub[2])}};
318 if (i.
used() == 1 && i[0][0] >= 0 && i[1][0] >= 0) {
324 if (t1 == 0 || t2 == 0) {
327 if (t1 == 1 || t2 == 1) {
346 double bc =
SkDInterp(src[2], src[4], t);
368 if (denom == 0 || numer == 0 || numer >= denom) {
371 double r = numer / denom;
414 return conic.hullIntersects(
fQuad, isLinear);
418 return cubic.hullIntersects(
fQuad, isLinear);
422 rect->setBounds(
fQuad);
static bool approximately_zero(double x)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static bool between(SkScalar a, SkScalar b, SkScalar c)
static bool pointInTriangle(const SkDPoint fPts[3], const SkDPoint &test)
static int valid_unit_divide(double numer, double denom, double *ratio)
static int handle_zero(const double B, const double C, double s[2])
static double interp_quad_coords(const double *src, double t)
static bool matchesEnd(const SkDPoint fPts[3], const SkDPoint &test)
bool AlmostBequalUlps(float a, float b)
bool AlmostDequalUlps(float a, float b)
bool approximately_less_than_zero(double x)
bool approximately_equal(double x, double y)
bool precisely_zero(double x)
bool approximately_one_or_less(double x)
bool approximately_zero_or_more(double x)
bool approximately_greater_than_one(double x)
double SkDInterp(double A, double B, double t)
bool approximately_zero_inverse(double x)
bool approximately_zero_when_compared_to(double x, double y)
bool zero_or_one(double x)
static int sign(SkScalar x)
int intersectRay(const SkDLine &, const SkDLine &)
const SkDPoint & pt(int index) const
double controlPtDistance(const SkDCubic &pts, int index) const
bool quadEndPoints(const SkDQuad &pts)
bool hullIntersects(const SkDQuad &quad, bool *isLinear) const override
void setBounds(SkDRect *) const override
int intersectRay(SkIntersections *i, const SkDLine &line) const override
static SkDPoint Mid(const SkDPoint &a, const SkDPoint &b)
static int RootsValidT(const double A, const double B, const double C, double s[2])
bool monotonicInY() const
void otherPts(int oddMan, const SkDPoint *endPt[2]) const
bool isLinear(int startIndex, int endIndex) const
static int RootsReal(double A, double B, double C, double t[2])
SkDQuadPair chopAt(double t) const
SkDQuad subDivide(double t1, double t2) const
void align(int endIndex, SkDPoint *dstPt) const
static int AddValidTs(double s[], int realRoots, double *t)
bool monotonicInX() const
bool hullIntersects(const SkDQuad &, bool *isLinear) const
static int FindExtrema(const double src[], double tValue[1])
SkDPoint ptAtT(double t) const
SkDPoint fPts[kPointCount]
SkDVector dxdyAtT(double t) const
static void SetABC(const double *quad, double *a, double *b, double *c)
static const int kPointCount
double dot(const SkDVector &a) const
static sk_sp< SkShader > linear(sk_sp< SkShader > shader)