437 {
439
453 double a1s = atan2(origin.
fY - quad1[1].fY, quad1[1].fX - origin.
fX);
454 double a1e = atan2(origin.
fY - quad1[2].fY, quad1[2].fX - origin.
fX);
455 double a2s = atan2(origin.
fY - quad2[1].fY, quad2[1].fX - origin.
fX);
456 double a2e = atan2(origin.
fY - quad2[2].fY, quad2[2].fX - origin.
fX);
461 bool realMatchesOverlap = realOverlap == overlap ||
SK_ScalarPI - fabs(a2s - a1s) < 0.002;
462 if (realOverlap != overlap) {
464 }
465 if (!realMatchesOverlap) {
466 DumpQ(quad1, quad2, testNo);
467 }
469 if (oldSchoolOverlap != (overlap < 0)) {
472 }
477 double vDir[2] = { v1s.
cross(v1e), v2s.
cross(v2e) };
478 bool ray1In2 = v1s.
cross(v2s) * vDir[1] <= 0 && v1s.
cross(v2e) * vDir[1] >= 0;
479 bool ray2In1 = v2s.
cross(v1s) * vDir[0] <= 0 && v2s.
cross(v1e) * vDir[0] >= 0;
480 if (overlap >= 0) {
481
484 bool ctrl1In2 = v1e.
cross(v2s) * vDir[1] <= 0 && v1e.
cross(v2e) * vDir[1] >= 0;
486 bool ctrl2In1 = v2e.
cross(v1s) * vDir[0] <= 0 && v2e.
cross(v1e) * vDir[0] >= 0;
488
490 }
491
492 SkDLine rays[] = {{{origin, quad2[2]}}, {{origin, quad1[2]}}};
493 const SkDQuad* quads[] = {&quad1, &quad2};
496 double minX, minY, maxX, maxY;
499 double maxWidth = 0;
500 bool useIntersect = false;
501 double smallestTs[] = {1, 1};
502 for (
unsigned index = 0; index <
std::size(quads); ++index) {
503 const SkDQuad& q = *quads[index];
504 midSpokes[index] = q.
ptAtT(0.5) - origin;
510 intersect[index].intersectRay(q, rays[index]);
513 bool foundZero = false;
514 double smallT = 1;
515 for (
int idx2 = 0; idx2 <
i.used(); ++idx2) {
516 double t =
i[0][idx2];
517 if (t == 0) {
518 foundZero = true;
519 continue;
520 }
521 if (smallT > t) {
522 smallT = t;
523 }
524 }
526 if (smallT == 1) {
527 continue;
528 }
531 if (ray.
fX *
end.fX < 0 || ray.
fY *
end.fY < 0) {
532 continue;
533 }
534 double rayDist = ray.
length();
535 double endDist =
end.length();
536 double delta = fabs(rayDist - endDist) / maxWidth;
538 useIntersect ^= true;
539 }
540 smallestTs[index] = smallT;
541 }
542 bool firstInside;
543 if (useIntersect) {
544 int sIndex = (
int) (smallestTs[1] < 1);
546 double t = smallestTs[sIndex];
547 const SkDQuad& q = *quads[sIndex];
550 double rayDist = ray.
length();
551 double endDist =
end.length();
555 SkDebugf(
"rayDist>endDist:%d sIndex==0:%d vDir[sIndex]<0:%d midXray<0:%d\n",
556 rayDist > endDist, sIndex == 0, vDir[sIndex] < 0, midXray < 0);
557 }
560 firstInside = (rayDist > endDist) ^ (sIndex == 0) ^ (vDir[sIndex] < 0);
561 } else if (overlap >= 0) {
562 return;
563 } else {
565 }
566 if (overlap < 0) {
569 *seg2->debugLastAngle());
570 SkASSERT(realEnds == (firstInside ? 1 : 0));
571 }
573}
static bool intersect(const SkPoint &p0, const SkPoint &n0, const SkPoint &p1, const SkPoint &n1, SkScalar *t)
static bool radianBetween(double start, double test, double end)
static void bruteForce(skiatest::Reporter *reporter, const SkDQuad &quad1, const SkDQuad &quad2, bool ccw)
static void makeSegment(SkOpContour *contour, const SkDQuad &quad, SkPoint shortQuad[3])
#define SkDEBUGPARAMS(...)
static int SkScalarSignAsInt(SkScalar x)
#define SkDoubleToScalar(x)
static int ConvexHullOverlaps(SkOpAngle &lh, SkOpAngle &rh)
SkOpAngle * debugLastAngle()
void debugAddAngle(double startT, double endT)
SkOpSegment * next() const
double cross(const SkDVector &a) const