125 int last = fIntersections->
used() - 1;
126 for (
int index = 0; index < last; ) {
127 double quadMidT = ((*fIntersections)[0][index] + (*fIntersections)[0][index + 1]) / 2;
129 double t = fLine->
nearPoint(quadMidPt,
nullptr);
163 double adj = (*fLine)[1].fX - (*fLine)[0].fX;
164 double opp = (*fLine)[1].fY - (*fLine)[0].fY;
166 for (
int n = 0; n < 3; ++n) {
167 r[n] = (fQuad[n].fY - (*fLine)[0].fY) * adj - (fQuad[n].fX - (*fLine)[0].fX) * opp;
184 for (
int index = 0; index <
roots; ++index) {
185 double quadT = rootVals[index];
189 fIntersections->
insert(quadT, lineT, pt);
193 return fIntersections->
used();
197 double D = fQuad[2].fY;
198 double E = fQuad[1].fY;
199 double F = fQuad[0].fY;
213 for (
int index = 0; index <
roots; ++index) {
214 double quadT = rootVals[index];
218 fIntersections->
insert(quadT, lineT, pt);
222 fIntersections->
flip();
225 return fIntersections->
used();
229 for (
int inner = 0; inner < fIntersections->
used(); ++inner) {
230 if (fIntersections->
pt(inner) != pt) {
233 double existingQuadT = (*fIntersections)[0][inner];
234 if (quadT == existingQuadT) {
238 double quadMidT = (existingQuadT + quadT) / 2;
246 SkDebugf(
"%s pt=(%1.9g,%1.9g) cPt=(%1.9g,%1.9g)\n", __FUNCTION__, pt.
fX, pt.
fY,
253 double D = fQuad[2].fX;
254 double E = fQuad[1].fX;
255 double F = fQuad[0].fX;
269 for (
int index = 0; index <
roots; ++index) {
270 double quadT = rootVals[index];
272 double lineT = (pt.
fY - top) / (bottom - top);
274 fIntersections->
insert(quadT, lineT, pt);
278 fIntersections->
flip();
281 return fIntersections->
used();
287 for (
int qIndex = 0; qIndex < 3; qIndex += 2) {
288 double lineT = fLine->
exactPoint(fQuad[qIndex]);
292 double quadT = (double) (qIndex >> 1);
293 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
298 for (
int qIndex = 0; qIndex < 3; qIndex += 2) {
299 double quadT = (double) (qIndex >> 1);
300 if (fIntersections->
hasT(quadT)) {
303 double lineT = fLine->
nearPoint(fQuad[qIndex],
nullptr);
307 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
313 for (
int lIndex = 0; lIndex < 2; ++lIndex) {
314 double lineT = (double) lIndex;
315 if (fIntersections->
hasOppT(lineT)) {
319 (*fLine)[lIndex], (*fLine)[!lIndex]);
323 fIntersections->
insert(quadT, lineT, (*fLine)[lIndex]);
328 for (
int qIndex = 0; qIndex < 3; qIndex += 2) {
333 double quadT = (double) (qIndex >> 1);
334 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
339 for (
int qIndex = 0; qIndex < 3; qIndex += 2) {
340 double quadT = (double) (qIndex >> 1);
341 if (fIntersections->
hasT(quadT)) {
348 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
354 for (
int qIndex = 0; qIndex < 3; qIndex += 2) {
359 double quadT = (double) (qIndex >> 1);
360 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
365 for (
int qIndex = 0; qIndex < 3; qIndex += 2) {
366 double quadT = (double) (qIndex >> 1);
367 if (fIntersections->
hasT(quadT)) {
374 fIntersections->
insert(quadT, lineT, fQuad[qIndex]);
381 double dx = (*fLine)[1].fX - (*fLine)[0].fX;
382 double dy = (*fLine)[1].fY - (*fLine)[0].fY;
383 if (fabs(
dx) > fabs(dy)) {
384 return (xy.
fX - (*fLine)[0].fX) /
dx;
386 return (xy.
fY - (*fLine)[0].fY) / dy;
396 double qT = *quadT =
SkPinT(*quadT);
397 double lT = *lineT =
SkPinT(*lineT);
399 *pt = (*fLine).ptAtT(lT);
401 *pt = fQuad.
ptAtT(qT);
414 if (gridPt == fQuad[0].asSkPoint()) {
417 }
else if (gridPt == fQuad[2].asSkPoint()) {
454 for (
int index = 0; index < fUsed; ++index) {
455 fPt[index] = quad.
ptAtT(fT[0][index]);
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
#define SkDEBUGPARAMS(...)
bool approximately_equal(double x, double y)
bool approximately_one_or_less_double(double x)
bool approximately_zero_or_more_double(double x)
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
int intersectRay(double roots[2])
LineQuadraticIntersections(const SkDQuad &q, const SkDLine &l, SkIntersections *i)
int verticalIntersect(double axisIntercept, double top, double bottom, bool flipped)
void allowNear(bool allow)
double findLineT(double t)
LineQuadraticIntersections(const SkDQuad &q)
void addExactHorizontalEndPoints(double left, double right, double y)
void addNearHorizontalEndPoints(double left, double right, double y)
bool uniqueAnswer(double quadT, const SkDPoint &pt)
int verticalIntersect(double axisIntercept, double roots[2])
void addLineNearEndPoints()
int horizontalIntersect(double axisIntercept, double roots[2])
bool pinTs(double *quadT, double *lineT, SkDPoint *pt, PinTPoint ptSet)
int horizontalIntersect(double axisIntercept, double left, double right, bool flipped)
void addExactVerticalEndPoints(double top, double bottom, double x)
void addNearVerticalEndPoints(double top, double bottom, double x)
int intersectRay(const SkDLine &, const SkDLine &)
int insert(double one, double two, const SkDPoint &pt)
int intersect(const SkDLine &, const SkDLine &)
void removeOne(int index)
const SkDPoint & pt(int index) const
static double VerticalIntercept(const SkDLine &line, double x)
int vertical(const SkDLine &, double top, double bottom, double x, bool flipped)
bool hasOppT(double t) const
bool hasT(double t) const
static double HorizontalIntercept(const SkDLine &line, double y)
void setCoincident(int index)
int horizontal(const SkDLine &, double left, double right, double y, bool flipped)
bool isCoincident(int index)
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
double exactPoint(const SkDPoint &xy) const
static double ExactPointV(const SkDPoint &xy, double top, double bottom, double x)
static double NearPointH(const SkDPoint &xy, double left, double right, double y)
static double NearPointV(const SkDPoint &xy, double top, double bottom, double x)
static double ExactPointH(const SkDPoint &xy, double left, double right, double y)
double nearPoint(const SkDPoint &xy, bool *unequal) const
bool approximatelyEqual(const SkDPoint &a) const
SkPoint asSkPoint() const
static bool ApproximatelyEqual(const SkPoint &a, const SkPoint &b)
static int RootsValidT(const double A, const double B, const double C, double s[2])
SkDPoint ptAtT(double t) const
int verticalIntersect(double xIntercept, double roots[2]) const
int horizontalIntersect(double yIntercept, double roots[2]) const