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;
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);
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;
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])}};
317 i.intersectRay(b0, b1);
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) {
368 if (denom == 0 || numer == 0 || numer >= denom) {
371 double r = numer / denom;
static bool approximately_zero(double x)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
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)
bool between(double a, double b, double c)
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)
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 float max(float r, float g, float b)
static float min(float r, float g, float b)
sk_sp< SkBlender > blender SkRect rect
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
const CatchEntryMove ab[]
SIN Vec< N, float > sqrt(const Vec< N, float > &x)
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)