| 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 return false; | 236 return false; |
| 237 } | 237 } |
| 238 return is_linear_inner(q1, 0, 1, q2, 0, 1, i, NULL); | 238 return is_linear_inner(q1, 0, 1, q2, 0, 1, i, NULL); |
| 239 } | 239 } |
| 240 | 240 |
| 241 // FIXME: if flat measure is sufficiently large, then probably the quartic solut
ion failed | 241 // FIXME: if flat measure is sufficiently large, then probably the quartic solut
ion failed |
| 242 static void relaxed_is_linear(const SkDQuad& q1, const SkDQuad& q2, SkIntersecti
ons* i) { | 242 static void relaxed_is_linear(const SkDQuad& q1, const SkDQuad& q2, SkIntersecti
ons* i) { |
| 243 double m1 = flat_measure(q1); | 243 double m1 = flat_measure(q1); |
| 244 double m2 = flat_measure(q2); | 244 double m2 = flat_measure(q2); |
| 245 #if DEBUG_FLAT_QUADS | 245 #if DEBUG_FLAT_QUADS |
| 246 double min = SkTMin<double>(m1, m2); | 246 double min = SkTMin(m1, m2); |
| 247 if (min > 5) { | 247 if (min > 5) { |
| 248 SkDebugf("%s maybe not flat enough.. %1.9g\n", __FUNCTION__, min); | 248 SkDebugf("%s maybe not flat enough.. %1.9g\n", __FUNCTION__, min); |
| 249 } | 249 } |
| 250 #endif | 250 #endif |
| 251 i->reset(); | 251 i->reset(); |
| 252 const SkDQuad& rounder = m2 < m1 ? q1 : q2; | 252 const SkDQuad& rounder = m2 < m1 ? q1 : q2; |
| 253 const SkDQuad& flatter = m2 < m1 ? q2 : q1; | 253 const SkDQuad& flatter = m2 < m1 ? q2 : q1; |
| 254 bool subDivide = false; | 254 bool subDivide = false; |
| 255 is_linear_inner(flatter, 0, 1, rounder, 0, 1, i, &subDivide); | 255 is_linear_inner(flatter, 0, 1, rounder, 0, 1, i, &subDivide); |
| 256 if (subDivide) { | 256 if (subDivide) { |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 } | 489 } |
| 490 if (lowestIndex < 0) { | 490 if (lowestIndex < 0) { |
| 491 break; | 491 break; |
| 492 } | 492 } |
| 493 insert(roots1Copy[lowestIndex], roots2Copy[closest[lowestIndex]], | 493 insert(roots1Copy[lowestIndex], roots2Copy[closest[lowestIndex]], |
| 494 pts1[lowestIndex]); | 494 pts1[lowestIndex]); |
| 495 closest[lowestIndex] = -1; | 495 closest[lowestIndex] = -1; |
| 496 } while (++used < r1Count); | 496 } while (++used < r1Count); |
| 497 return fUsed; | 497 return fUsed; |
| 498 } | 498 } |
| OLD | NEW |