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

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

Issue 21359002: path ops work in progress (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove space Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « src/pathops/SkDLineIntersection.cpp ('k') | src/pathops/SkDQuadLineIntersection.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 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
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
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 }
OLDNEW
« no previous file with comments | « src/pathops/SkDLineIntersection.cpp ('k') | src/pathops/SkDQuadLineIntersection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698