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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 } | 415 } |
416 // see if either quad is really a line | 416 // see if either quad is really a line |
417 // FIXME: figure out why reduce step didn't find this earlier | 417 // FIXME: figure out why reduce step didn't find this earlier |
418 if (is_linear(q1, q2, this)) { | 418 if (is_linear(q1, q2, this)) { |
419 return fUsed; | 419 return fUsed; |
420 } | 420 } |
421 SkIntersections swapped; | 421 SkIntersections swapped; |
422 swapped.setMax(fMax); | 422 swapped.setMax(fMax); |
423 if (is_linear(q2, q1, &swapped)) { | 423 if (is_linear(q2, q1, &swapped)) { |
424 swapped.swapPts(); | 424 swapped.swapPts(); |
425 set(swapped); | 425 *this = swapped; |
426 return fUsed; | 426 return fUsed; |
427 } | 427 } |
428 SkIntersections copyI(*this); | 428 SkIntersections copyI(*this); |
429 lookNearEnd(q1, q2, 0, *this, false, ©I); | 429 lookNearEnd(q1, q2, 0, *this, false, ©I); |
430 lookNearEnd(q1, q2, 1, *this, false, ©I); | 430 lookNearEnd(q1, q2, 1, *this, false, ©I); |
431 lookNearEnd(q2, q1, 0, *this, true, ©I); | 431 lookNearEnd(q2, q1, 0, *this, true, ©I); |
432 lookNearEnd(q2, q1, 1, *this, true, ©I); | 432 lookNearEnd(q2, q1, 1, *this, true, ©I); |
433 int innerEqual = 0; | 433 int innerEqual = 0; |
434 if (copyI.fUsed >= 2) { | 434 if (copyI.fUsed >= 2) { |
435 SkASSERT(copyI.fUsed <= 4); | 435 SkASSERT(copyI.fUsed <= 4); |
(...skipping 110 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 |