Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: src/pathops/SkDQuadIntersection.cpp

Issue 456383003: relax quadratic binary search test (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up temporary test scaffolding Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Another approach is to start with the implicit form of one curve and solve 1 // Another approach is to start with the implicit form of one curve and solve
2 // (seek implicit coefficients in QuadraticParameter.cpp 2 // (seek implicit coefficients in QuadraticParameter.cpp
3 // by substituting in the parametric form of the other. 3 // by substituting in the parametric form of the other.
4 // The downside of this approach is that early rejects are difficult to come by. 4 // The downside of this approach is that early rejects are difficult to come by.
5 // http://planetmath.org/encyclopedia/GaloisTheoreticDerivationOfTheQuarticFormu la.html#step 5 // http://planetmath.org/encyclopedia/GaloisTheoreticDerivationOfTheQuarticFormu la.html#step
6 6
7 #include "SkDQuadImplicit.h" 7 #include "SkDQuadImplicit.h"
8 #include "SkIntersections.h" 8 #include "SkIntersections.h"
9 #include "SkPathOpsLine.h" 9 #include "SkPathOpsLine.h"
10 #include "SkQuarticRoot.h" 10 #include "SkQuarticRoot.h"
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 double roots2Copy[4]; 479 double roots2Copy[4];
480 int r2Count = addValidRoots(roots2, rootCount2, roots2Copy); 480 int r2Count = addValidRoots(roots2, rootCount2, roots2Copy);
481 SkDPoint pts2[4]; 481 SkDPoint pts2[4];
482 for (index = 0; index < r2Count; ++index) { 482 for (index = 0; index < r2Count; ++index) {
483 pts2[index] = q2.ptAtT(roots2Copy[index]); 483 pts2[index] = q2.ptAtT(roots2Copy[index]);
484 } 484 }
485 if (r1Count == r2Count && r1Count <= 1) { 485 if (r1Count == r2Count && r1Count <= 1) {
486 if (r1Count == 1 && used() == 0) { 486 if (r1Count == 1 && used() == 0) {
487 if (pts1[0].approximatelyEqual(pts2[0])) { 487 if (pts1[0].approximatelyEqual(pts2[0])) {
488 insert(roots1Copy[0], roots2Copy[0], pts1[0]); 488 insert(roots1Copy[0], roots2Copy[0], pts1[0]);
489 } else if (pts1[0].moreRoughlyEqual(pts2[0])) { 489 } else {
490 // experiment: try to find intersection by chasing t 490 // find intersection by chasing t
491 if (binary_search(q1, q2, roots1Copy, roots2Copy, pts1)) { 491 if (binary_search(q1, q2, roots1Copy, roots2Copy, pts1)) {
492 insert(roots1Copy[0], roots2Copy[0], pts1[0]); 492 insert(roots1Copy[0], roots2Copy[0], pts1[0]);
493 } 493 }
494 } 494 }
495 } 495 }
496 return fUsed; 496 return fUsed;
497 } 497 }
498 int closest[4]; 498 int closest[4];
499 double dist[4]; 499 double dist[4];
500 bool foundSomething = false; 500 bool foundSomething = false;
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 } 546 }
547 if (lowestIndex < 0) { 547 if (lowestIndex < 0) {
548 break; 548 break;
549 } 549 }
550 insert(roots1Copy[lowestIndex], roots2Copy[closest[lowestIndex]], 550 insert(roots1Copy[lowestIndex], roots2Copy[closest[lowestIndex]],
551 pts1[lowestIndex]); 551 pts1[lowestIndex]);
552 closest[lowestIndex] = -1; 552 closest[lowestIndex] = -1;
553 } while (++used < r1Count); 553 } while (++used < r1Count);
554 return fUsed; 554 return fUsed;
555 } 555 }
OLDNEW
« no previous file with comments | « no previous file | tests/PathOpsOpTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698