| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |