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 | 7 |
8 #include "SkDQuadImplicit.h" | 8 #include "SkDQuadImplicit.h" |
9 #include "SkIntersections.h" | 9 #include "SkIntersections.h" |
10 #include "SkPathOpsLine.h" | 10 #include "SkPathOpsLine.h" |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
384 if (swap) { | 384 if (swap) { |
385 i->insert(testT, impTs[0][index], tmpLine[0]); | 385 i->insert(testT, impTs[0][index], tmpLine[0]); |
386 } else { | 386 } else { |
387 i->insert(impTs[0][index], testT, tmpLine[0]); | 387 i->insert(impTs[0][index], testT, tmpLine[0]); |
388 } | 388 } |
389 } | 389 } |
390 } | 390 } |
391 | 391 |
392 int SkIntersections::intersect(const SkDQuad& q1, const SkDQuad& q2) { | 392 int SkIntersections::intersect(const SkDQuad& q1, const SkDQuad& q2) { |
393 // if the quads share an end point, check to see if they overlap | 393 // if the quads share an end point, check to see if they overlap |
394 | |
395 for (int i1 = 0; i1 < 3; i1 += 2) { | 394 for (int i1 = 0; i1 < 3; i1 += 2) { |
396 for (int i2 = 0; i2 < 3; i2 += 2) { | 395 for (int i2 = 0; i2 < 3; i2 += 2) { |
397 if (q1[i1].approximatelyEqualHalf(q2[i2])) { | 396 if (q1[i1] == q2[i2]) { |
398 insert(i1 >> 1, i2 >> 1, q1[i1]); | 397 insert(i1 >> 1, i2 >> 1, q1[i1]); |
399 } | 398 } |
400 } | 399 } |
401 } | 400 } |
| 401 if (fAllowNear || true) { // FIXME ? cubic/cubic intersection fails withou
t (cubicOp67u) |
| 402 for (int i1 = 0; i1 < 3; i1 += 2) { |
| 403 for (int i2 = 0; i2 < 3; i2 += 2) { |
| 404 if (q1[i1] != q2[i2] && q1[i1].approximatelyEqualHalf(q2[i2])) { |
| 405 insertNear(i1 >> 1, i2 >> 1, q1[i1]); |
| 406 } |
| 407 } |
| 408 } |
| 409 } |
402 SkASSERT(fUsed < 3); | 410 SkASSERT(fUsed < 3); |
403 if (only_end_pts_in_common(q1, q2)) { | 411 if (only_end_pts_in_common(q1, q2)) { |
404 return fUsed; | 412 return fUsed; |
405 } | 413 } |
406 if (only_end_pts_in_common(q2, q1)) { | 414 if (only_end_pts_in_common(q2, q1)) { |
407 return fUsed; | 415 return fUsed; |
408 } | 416 } |
409 // see if either quad is really a line | 417 // see if either quad is really a line |
410 // FIXME: figure out why reduce step didn't find this earlier | 418 // FIXME: figure out why reduce step didn't find this earlier |
411 if (is_linear(q1, q2, this)) { | 419 if (is_linear(q1, q2, this)) { |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 } | 550 } |
543 if (lowestIndex < 0) { | 551 if (lowestIndex < 0) { |
544 break; | 552 break; |
545 } | 553 } |
546 insert(roots1Copy[lowestIndex], roots2Copy[closest[lowestIndex]], | 554 insert(roots1Copy[lowestIndex], roots2Copy[closest[lowestIndex]], |
547 pts1[lowestIndex]); | 555 pts1[lowestIndex]); |
548 closest[lowestIndex] = -1; | 556 closest[lowestIndex] = -1; |
549 } while (++used < r1Count); | 557 } while (++used < r1Count); |
550 return fUsed; | 558 return fUsed; |
551 } | 559 } |
OLD | NEW |