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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 tsFound.push_back(rootTs[0][idx2]); | 168 tsFound.push_back(rootTs[0][idx2]); |
169 } | 169 } |
170 } | 170 } |
171 int tCount = tsFound.count(); | 171 int tCount = tsFound.count(); |
172 if (tCount <= 0) { | 172 if (tCount <= 0) { |
173 return true; | 173 return true; |
174 } | 174 } |
175 double tMin, tMax; | 175 double tMin, tMax; |
176 if (tCount == 1) { | 176 if (tCount == 1) { |
177 tMin = tMax = tsFound[0]; | 177 tMin = tMax = tsFound[0]; |
178 } else if (tCount > 1) { | 178 } else { |
| 179 SkASSERT(tCount > 1); |
179 SkTQSort<double>(tsFound.begin(), tsFound.end() - 1); | 180 SkTQSort<double>(tsFound.begin(), tsFound.end() - 1); |
180 tMin = tsFound[0]; | 181 tMin = tsFound[0]; |
181 tMax = tsFound[tsFound.count() - 1]; | 182 tMax = tsFound[tsFound.count() - 1]; |
182 } | 183 } |
183 SkDPoint end = q2.xyAtT(t2s); | 184 SkDPoint end = q2.xyAtT(t2s); |
184 bool startInTriangle = hull.pointInHull(end); | 185 bool startInTriangle = hull.pointInHull(end); |
185 if (startInTriangle) { | 186 if (startInTriangle) { |
186 tMin = t2s; | 187 tMin = t2s; |
187 } | 188 } |
188 end = q2.xyAtT(t2e); | 189 end = q2.xyAtT(t2e); |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 } | 499 } |
499 if (lowestIndex < 0) { | 500 if (lowestIndex < 0) { |
500 break; | 501 break; |
501 } | 502 } |
502 insert(roots1Copy[lowestIndex], roots2Copy[closest[lowestIndex]], | 503 insert(roots1Copy[lowestIndex], roots2Copy[closest[lowestIndex]], |
503 pts1[lowestIndex]); | 504 pts1[lowestIndex]); |
504 closest[lowestIndex] = -1; | 505 closest[lowestIndex] = -1; |
505 } while (++used < r1Count); | 506 } while (++used < r1Count); |
506 return fUsed; | 507 return fUsed; |
507 } | 508 } |
OLD | NEW |