| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 #include "PathOpsQuadIntersectionTestData.h" | 7 #include "PathOpsQuadIntersectionTestData.h" |
| 8 #include "PathOpsTestCommon.h" | 8 #include "PathOpsTestCommon.h" |
| 9 #include "SkIntersections.h" | 9 #include "SkIntersections.h" |
| 10 #include "SkPathOpsRect.h" | 10 #include "SkPathOpsRect.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 if (showSkipped) { | 30 if (showSkipped) { |
| 31 SkDebugf("[%d] quad2 order=%d\n", static_cast<int>(index), order
2); | 31 SkDebugf("[%d] quad2 order=%d\n", static_cast<int>(index), order
2); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 if (order1 == 3 && order2 == 3) { | 34 if (order1 == 3 && order2 == 3) { |
| 35 SkIntersections intersections; | 35 SkIntersections intersections; |
| 36 intersections.intersect(quad1, quad2); | 36 intersections.intersect(quad1, quad2); |
| 37 if (intersections.used() > 0) { | 37 if (intersections.used() > 0) { |
| 38 for (int pt = 0; pt < intersections.used(); ++pt) { | 38 for (int pt = 0; pt < intersections.used(); ++pt) { |
| 39 double tt1 = intersections[0][pt]; | 39 double tt1 = intersections[0][pt]; |
| 40 SkDPoint xy1 = quad1.xyAtT(tt1); | 40 SkDPoint xy1 = quad1.ptAtT(tt1); |
| 41 double tt2 = intersections[1][pt]; | 41 double tt2 = intersections[1][pt]; |
| 42 SkDPoint xy2 = quad2.xyAtT(tt2); | 42 SkDPoint xy2 = quad2.ptAtT(tt2); |
| 43 if (!xy1.approximatelyEqual(xy2)) { | 43 if (!xy1.approximatelyEqual(xy2)) { |
| 44 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n", | 44 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n", |
| 45 __FUNCTION__, static_cast<int>(index), pt, tt1,
xy1.fX, xy1.fY, | 45 __FUNCTION__, static_cast<int>(index), pt, tt1,
xy1.fX, xy1.fY, |
| 46 tt2, xy2.fX, xy2.fY); | 46 tt2, xy2.fX, xy2.fY); |
| 47 REPORTER_ASSERT(reporter, 0); | 47 REPORTER_ASSERT(reporter, 0); |
| 48 } | 48 } |
| 49 } | 49 } |
| 50 } | 50 } |
| 51 } | 51 } |
| 52 } | 52 } |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 249 |
| 250 static void oneOffTest1(skiatest::Reporter* reporter, size_t outer, size_t inner
) { | 250 static void oneOffTest1(skiatest::Reporter* reporter, size_t outer, size_t inner
) { |
| 251 const SkDQuad& quad1 = testSet[outer]; | 251 const SkDQuad& quad1 = testSet[outer]; |
| 252 SkASSERT(ValidQuad(quad1)); | 252 SkASSERT(ValidQuad(quad1)); |
| 253 const SkDQuad& quad2 = testSet[inner]; | 253 const SkDQuad& quad2 = testSet[inner]; |
| 254 SkASSERT(ValidQuad(quad2)); | 254 SkASSERT(ValidQuad(quad2)); |
| 255 SkIntersections intersections2; | 255 SkIntersections intersections2; |
| 256 intersections2.intersect(quad1, quad2); | 256 intersections2.intersect(quad1, quad2); |
| 257 for (int pt = 0; pt < intersections2.used(); ++pt) { | 257 for (int pt = 0; pt < intersections2.used(); ++pt) { |
| 258 double tt1 = intersections2[0][pt]; | 258 double tt1 = intersections2[0][pt]; |
| 259 SkDPoint xy1 = quad1.xyAtT(tt1); | 259 SkDPoint xy1 = quad1.ptAtT(tt1); |
| 260 double tt2 = intersections2[1][pt]; | 260 double tt2 = intersections2[1][pt]; |
| 261 SkDPoint xy2 = quad2.xyAtT(tt2); | 261 SkDPoint xy2 = quad2.ptAtT(tt2); |
| 262 if (!xy1.approximatelyEqual(xy2)) { | 262 if (!xy1.approximatelyEqual(xy2)) { |
| 263 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n", | 263 SkDebugf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n", |
| 264 __FUNCTION__, static_cast<int>(outer), static_cast<int>(inne
r), | 264 __FUNCTION__, static_cast<int>(outer), static_cast<int>(inne
r), |
| 265 tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY); | 265 tt1, xy1.fX, xy1.fY, tt2, xy2.fX, xy2.fY); |
| 266 REPORTER_ASSERT(reporter, 0); | 266 REPORTER_ASSERT(reporter, 0); |
| 267 } | 267 } |
| 268 #if ONE_OFF_DEBUG | 268 #if ONE_OFF_DEBUG |
| 269 SkDebugf("%s [%d][%d] t1=%1.9g (%1.9g, %1.9g) t2=%1.9g\n", __FUNCTION__, | 269 SkDebugf("%s [%d][%d] t1=%1.9g (%1.9g, %1.9g) t2=%1.9g\n", __FUNCTION__, |
| 270 outer, inner, tt1, xy1.fX, xy1.fY, tt2); | 270 outer, inner, tt1, xy1.fX, xy1.fY, tt2); |
| 271 #endif | 271 #endif |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 static void PathOpsQuadIntersectionOneOffTest(skiatest::Reporter* reporter) { | 275 static void PathOpsQuadIntersectionOneOffTest(skiatest::Reporter* reporter) { |
| 276 oneOffTest1(reporter, 0, 1); | 276 oneOffTest1(reporter, 0, 1); |
| 277 } | 277 } |
| 278 | 278 |
| 279 static void oneOffTests(skiatest::Reporter* reporter) { | 279 static void oneOffTests(skiatest::Reporter* reporter) { |
| 280 for (size_t outer = 0; outer < testSetCount - 1; ++outer) { | 280 for (size_t outer = 0; outer < testSetCount - 1; ++outer) { |
| 281 for (size_t inner = outer + 1; inner < testSetCount; ++inner) { | 281 for (size_t inner = outer + 1; inner < testSetCount; ++inner) { |
| 282 oneOffTest1(reporter, outer, inner); | 282 oneOffTest1(reporter, outer, inner); |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 } | 285 } |
| 286 | 286 |
| 287 static const SkDQuad coincidentTestSet[] = { | 287 static const SkDQuad coincidentTestSet[] = { |
| 288 {{{97.9337615966796875,100}, {88,112.94264984130859375}, {88,130}}}, |
| 289 {{{88,130}, {88,124.80951690673828125}, {88.91983795166015625,120}}}, |
| 288 {{{369.850525, 145.675964}, {382.362915, 121.29287}, {406.211273, 121.29287}
}}, | 290 {{{369.850525, 145.675964}, {382.362915, 121.29287}, {406.211273, 121.29287}
}}, |
| 289 {{{369.850525, 145.675964}, {382.362915, 121.29287}, {406.211273, 121.29287}
}}, | 291 {{{369.850525, 145.675964}, {382.362915, 121.29287}, {406.211273, 121.29287}
}}, |
| 290 {{{8, 8}, {10, 10}, {8, -10}}}, | 292 {{{8, 8}, {10, 10}, {8, -10}}}, |
| 291 {{{8, -10}, {10, 10}, {8, 8}}}, | 293 {{{8, -10}, {10, 10}, {8, 8}}}, |
| 292 }; | 294 }; |
| 293 | 295 |
| 294 const size_t coincidentTestSetCount = SK_ARRAY_COUNT(coincidentTestSet); | 296 const size_t coincidentTestSetCount = SK_ARRAY_COUNT(coincidentTestSet); |
| 295 | 297 |
| 298 static void coincidentTestOne(skiatest::Reporter* reporter, int test1, int test2
) { |
| 299 const SkDQuad& quad1 = coincidentTestSet[test1]; |
| 300 SkASSERT(ValidQuad(quad1)); |
| 301 const SkDQuad& quad2 = coincidentTestSet[test2]; |
| 302 SkASSERT(ValidQuad(quad2)); |
| 303 SkIntersections intersections2; |
| 304 intersections2.intersect(quad1, quad2); |
| 305 REPORTER_ASSERT(reporter, intersections2.coincidentUsed() == 2); |
| 306 REPORTER_ASSERT(reporter, intersections2.used() == 2); |
| 307 for (int pt = 0; pt < intersections2.coincidentUsed(); ++pt) { |
| 308 double tt1 = intersections2[0][pt]; |
| 309 double tt2 = intersections2[1][pt]; |
| 310 SkDPoint pt1 = quad1.ptAtT(tt1); |
| 311 SkDPoint pt2 = quad2.ptAtT(tt2); |
| 312 REPORTER_ASSERT(reporter, pt1.approximatelyEqual(pt2)); |
| 313 } |
| 314 } |
| 315 |
| 296 static void coincidentTest(skiatest::Reporter* reporter) { | 316 static void coincidentTest(skiatest::Reporter* reporter) { |
| 297 for (size_t testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex
+= 2) { | 317 for (size_t testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex
+= 2) { |
| 298 const SkDQuad& quad1 = coincidentTestSet[testIndex]; | 318 coincidentTestOne(reporter, testIndex, testIndex + 1); |
| 299 SkASSERT(ValidQuad(quad1)); | |
| 300 const SkDQuad& quad2 = coincidentTestSet[testIndex + 1]; | |
| 301 SkASSERT(ValidQuad(quad2)); | |
| 302 SkIntersections intersections2; | |
| 303 intersections2.intersect(quad1, quad2); | |
| 304 REPORTER_ASSERT(reporter, intersections2.coincidentUsed() == 2); | |
| 305 REPORTER_ASSERT(reporter, intersections2.used() == 2); | |
| 306 for (int pt = 0; pt < intersections2.coincidentUsed(); ++pt) { | |
| 307 double tt1 = intersections2[0][pt]; | |
| 308 double tt2 = intersections2[1][pt]; | |
| 309 REPORTER_ASSERT(reporter, approximately_equal(1, tt1) || approximate
ly_zero(tt1)); | |
| 310 REPORTER_ASSERT(reporter, approximately_equal(1, tt2) || approximate
ly_zero(tt2)); | |
| 311 } | |
| 312 } | 319 } |
| 313 } | 320 } |
| 314 | 321 |
| 322 static void PathOpsQuadIntersectionCoincidenceOneOffTest(skiatest::Reporter* rep
orter) { |
| 323 coincidentTestOne(reporter, 0, 1); |
| 324 } |
| 325 |
| 315 static int floatSign(double x) { | 326 static int floatSign(double x) { |
| 316 return x < 0 ? -1 : x > 0 ? 1 : 0; | 327 return x < 0 ? -1 : x > 0 ? 1 : 0; |
| 317 } | 328 } |
| 318 | 329 |
| 319 static const SkDQuad pointFinderTestSet[] = { | 330 static const SkDQuad pointFinderTestSet[] = { |
| 320
//>=0.633974464 0.633974
846 <= | 331
//>=0.633974464 0.633974
846 <= |
| 321 {{{1.2071879545809394, 0.82163474041730045}, {1.1534203513372994, 0.527908700699
30229}, | 332 {{{1.2071879545809394, 0.82163474041730045}, {1.1534203513372994, 0.527908700699
30229}, |
| 322 {1.0880000000000001, 0.29599999999999982}}}, //t=0.63155333662549329, 0
.80000000000000004 | 333 {1.0880000000000001, 0.29599999999999982}}}, //t=0.63155333662549329, 0
.80000000000000004 |
| 323 {{{1.2071879545809394, 0.82163474041730045}, {1.2065040319428038, 0.817667532591
19995}, | 334 {{{1.2071879545809394, 0.82163474041730045}, {1.2065040319428038, 0.817667532591
19995}, |
| 324 {1.2058123269101506, 0.81370135061854221}}}, //t=0.63155333662549329, 0
.6339049773632347 | 335 {1.2058123269101506, 0.81370135061854221}}}, //t=0.63155333662549329, 0
.6339049773632347 |
| 325 {{{1.2058123269101506, 0.81370135061854221}, {1.152376363978022, 0.5244097415381
026}, | 336 {{{1.2058123269101506, 0.81370135061854221}, {1.152376363978022, 0.5244097415381
026}, |
| 326 {1.0880000000000001, 0.29599999999999982}}}, //t=0.6339049773632347, 0
.80000000000000004 | 337 {1.0880000000000001, 0.29599999999999982}}}, //t=0.6339049773632347, 0
.80000000000000004 |
| 327
//>=0.633974083 0.633975
227 <= | 338
//>=0.633974083 0.633975
227 <= |
| 328 {{{0.33333333333333326, 0.81481481481481488}, {0.63395173631977997, 0.6874413672
6313931}, | 339 {{{0.33333333333333326, 0.81481481481481488}, {0.63395173631977997, 0.6874413672
6313931}, |
| 329 {1.205684411948591, 0.81344322326274499}}}, //t=0.33333333333333331, 0
.63395173631977986 | 340 {1.205684411948591, 0.81344322326274499}}}, //t=0.33333333333333331, 0
.63395173631977986 |
| 330 {{{0.33333333333333326, 0.81481481481481488}, {0.63396444791444551, 0.6874336836
2444768}, | 341 {{{0.33333333333333326, 0.81481481481481488}, {0.63396444791444551, 0.6874336836
2444768}, |
| 331 {1.205732763658403, 0.81345617746834109}}}, //t=0.33333333333333331, 0
.63396444791444551 | 342 {1.205732763658403, 0.81345617746834109}}}, //t=0.33333333333333331, 0
.63396444791444551 |
| 332 {{{1.205684411948591, 0.81344322326274499}, {1.2057085875611198, 0.8134496999932
9253}, | 343 {{{1.205684411948591, 0.81344322326274499}, {1.2057085875611198, 0.8134496999932
9253}, |
| 333 {1.205732763658403, 0.81345617746834109}}}, //t=0.63395173631977986, 0
.63396444791444551 | 344 {1.205732763658403, 0.81345617746834109}}}, //t=0.63395173631977986, 0
.63396444791444551 |
| 334 {{{1.205732763658403, 0.81345617746834109}, {1.267928895828891, 0.83008534558465
619}, | 345 {{{1.205732763658403, 0.81345617746834109}, {1.267928895828891, 0.83008534558465
619}, |
| 335 {1.3333333333333333, 0.85185185185185175}}}, //t=0.63396444791444551, 0
.66666666666666663 | 346 {1.3333333333333333, 0.85185185185185175}}}, //t=0.63396444791444551, 0
.66666666666666663 |
| 336 }; | 347 }; |
| 337 | 348 |
| 338 static void pointFinder(const SkDQuad& q1, const SkDQuad& q2) { | 349 static void pointFinder(const SkDQuad& q1, const SkDQuad& q2) { |
| 339 for (int index = 0; index < 3; ++index) { | 350 for (int index = 0; index < 3; ++index) { |
| 340 double t = q1.nearestT(q2[index]); | 351 double t = q1.nearestT(q2[index]); |
| 341 SkDPoint onQuad = q1.xyAtT(t); | 352 SkDPoint onQuad = q1.ptAtT(t); |
| 342 SkDebugf("%s t=%1.9g (%1.9g,%1.9g) dist=%1.9g\n", __FUNCTION__, t, onQua
d.fX, onQuad.fY, | 353 SkDebugf("%s t=%1.9g (%1.9g,%1.9g) dist=%1.9g\n", __FUNCTION__, t, onQua
d.fX, onQuad.fY, |
| 343 onQuad.distance(q2[index])); | 354 onQuad.distance(q2[index])); |
| 344 double left[3]; | 355 double left[3]; |
| 345 left[0] = ((const SkDLine&) q1[0]).isLeft(q2[index]); | 356 left[0] = ((const SkDLine&) q1[0]).isLeft(q2[index]); |
| 346 left[1] = ((const SkDLine&) q1[1]).isLeft(q2[index]); | 357 left[1] = ((const SkDLine&) q1[1]).isLeft(q2[index]); |
| 347 SkDLine diag = {{q1[0], q1[2]}}; | 358 SkDLine diag = {{q1[0], q1[2]}}; |
| 348 left[2] = diag.isLeft(q2[index]); | 359 left[2] = diag.isLeft(q2[index]); |
| 349 SkDebugf("%s left=(%d, %d, %d) inHull=%s\n", __FUNCTION__, floatSign(lef
t[0]), | 360 SkDebugf("%s left=(%d, %d, %d) inHull=%s\n", __FUNCTION__, floatSign(lef
t[0]), |
| 350 floatSign(left[1]), floatSign(left[2]), | 361 floatSign(left[1]), floatSign(left[2]), |
| 351 q1.pointInHull(q2[index]) ? "true" : "false"); | 362 q1.pointInHull(q2[index]) ? "true" : "false"); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 381 const SkDQuad& quad1 = testSet[test1]; | 392 const SkDQuad& quad1 = testSet[test1]; |
| 382 const SkDQuad& quad2 = testSet[test2]; | 393 const SkDQuad& quad2 = testSet[test2]; |
| 383 | 394 |
| 384 double t1Seed = 0.5; | 395 double t1Seed = 0.5; |
| 385 double t2Seed = 0.8; | 396 double t2Seed = 0.8; |
| 386 double t1Step = 0.1; | 397 double t1Step = 0.1; |
| 387 double t2Step = 0.1; | 398 double t2Step = 0.1; |
| 388 SkDPoint t1[3], t2[3]; | 399 SkDPoint t1[3], t2[3]; |
| 389 bool toggle = true; | 400 bool toggle = true; |
| 390 do { | 401 do { |
| 391 t1[0] = quad1.xyAtT(t1Seed - t1Step); | 402 t1[0] = quad1.ptAtT(t1Seed - t1Step); |
| 392 t1[1] = quad1.xyAtT(t1Seed); | 403 t1[1] = quad1.ptAtT(t1Seed); |
| 393 t1[2] = quad1.xyAtT(t1Seed + t1Step); | 404 t1[2] = quad1.ptAtT(t1Seed + t1Step); |
| 394 t2[0] = quad2.xyAtT(t2Seed - t2Step); | 405 t2[0] = quad2.ptAtT(t2Seed - t2Step); |
| 395 t2[1] = quad2.xyAtT(t2Seed); | 406 t2[1] = quad2.ptAtT(t2Seed); |
| 396 t2[2] = quad2.xyAtT(t2Seed + t2Step); | 407 t2[2] = quad2.ptAtT(t2Seed + t2Step); |
| 397 double dist[3][3]; | 408 double dist[3][3]; |
| 398 dist[1][1] = t1[1].distance(t2[1]); | 409 dist[1][1] = t1[1].distance(t2[1]); |
| 399 int best_i = 1, best_j = 1; | 410 int best_i = 1, best_j = 1; |
| 400 for (int i = 0; i < 3; ++i) { | 411 for (int i = 0; i < 3; ++i) { |
| 401 for (int j = 0; j < 3; ++j) { | 412 for (int j = 0; j < 3; ++j) { |
| 402 if (i == 1 && j == 1) { | 413 if (i == 1 && j == 1) { |
| 403 continue; | 414 continue; |
| 404 } | 415 } |
| 405 dist[i][j] = t1[i].distance(t2[j]); | 416 dist[i][j] = t1[i].distance(t2[j]); |
| 406 if (dist[best_i][best_j] > dist[i][j]) { | 417 if (dist[best_i][best_j] > dist[i][j]) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 427 } | 438 } |
| 428 } | 439 } |
| 429 } while (!t1[1].approximatelyEqual(t2[1])); | 440 } while (!t1[1].approximatelyEqual(t2[1])); |
| 430 t1Step = t2Step = 0.1; | 441 t1Step = t2Step = 0.1; |
| 431 double t10 = t1Seed - t1Step * 2; | 442 double t10 = t1Seed - t1Step * 2; |
| 432 double t12 = t1Seed + t1Step * 2; | 443 double t12 = t1Seed + t1Step * 2; |
| 433 double t20 = t2Seed - t2Step * 2; | 444 double t20 = t2Seed - t2Step * 2; |
| 434 double t22 = t2Seed + t2Step * 2; | 445 double t22 = t2Seed + t2Step * 2; |
| 435 SkDPoint test; | 446 SkDPoint test; |
| 436 while (!approximately_zero(t1Step)) { | 447 while (!approximately_zero(t1Step)) { |
| 437 test = quad1.xyAtT(t10); | 448 test = quad1.ptAtT(t10); |
| 438 t10 += t1[1].approximatelyEqual(test) ? -t1Step : t1Step; | 449 t10 += t1[1].approximatelyEqual(test) ? -t1Step : t1Step; |
| 439 t1Step /= 2; | 450 t1Step /= 2; |
| 440 } | 451 } |
| 441 t1Step = 0.1; | 452 t1Step = 0.1; |
| 442 while (!approximately_zero(t1Step)) { | 453 while (!approximately_zero(t1Step)) { |
| 443 test = quad1.xyAtT(t12); | 454 test = quad1.ptAtT(t12); |
| 444 t12 -= t1[1].approximatelyEqual(test) ? -t1Step : t1Step; | 455 t12 -= t1[1].approximatelyEqual(test) ? -t1Step : t1Step; |
| 445 t1Step /= 2; | 456 t1Step /= 2; |
| 446 } | 457 } |
| 447 while (!approximately_zero(t2Step)) { | 458 while (!approximately_zero(t2Step)) { |
| 448 test = quad2.xyAtT(t20); | 459 test = quad2.ptAtT(t20); |
| 449 t20 += t2[1].approximatelyEqual(test) ? -t2Step : t2Step; | 460 t20 += t2[1].approximatelyEqual(test) ? -t2Step : t2Step; |
| 450 t2Step /= 2; | 461 t2Step /= 2; |
| 451 } | 462 } |
| 452 t2Step = 0.1; | 463 t2Step = 0.1; |
| 453 while (!approximately_zero(t2Step)) { | 464 while (!approximately_zero(t2Step)) { |
| 454 test = quad2.xyAtT(t22); | 465 test = quad2.ptAtT(t22); |
| 455 t22 -= t2[1].approximatelyEqual(test) ? -t2Step : t2Step; | 466 t22 -= t2[1].approximatelyEqual(test) ? -t2Step : t2Step; |
| 456 t2Step /= 2; | 467 t2Step /= 2; |
| 457 } | 468 } |
| 458 #if ONE_OFF_DEBUG | 469 #if ONE_OFF_DEBUG |
| 459 SkDebugf("%s t1=(%1.9g<%1.9g<%1.9g) t2=(%1.9g<%1.9g<%1.9g)\n", __FUNCTION__, | 470 SkDebugf("%s t1=(%1.9g<%1.9g<%1.9g) t2=(%1.9g<%1.9g<%1.9g)\n", __FUNCTION__, |
| 460 t10, t1Seed, t12, t20, t2Seed, t22); | 471 t10, t1Seed, t12, t20, t2Seed, t22); |
| 461 SkDPoint p10 = quad1.xyAtT(t10); | 472 SkDPoint p10 = quad1.ptAtT(t10); |
| 462 SkDPoint p1Seed = quad1.xyAtT(t1Seed); | 473 SkDPoint p1Seed = quad1.ptAtT(t1Seed); |
| 463 SkDPoint p12 = quad1.xyAtT(t12); | 474 SkDPoint p12 = quad1.ptAtT(t12); |
| 464 SkDebugf("%s p1=(%1.9g,%1.9g)<(%1.9g,%1.9g)<(%1.9g,%1.9g)\n", __FUNCTION__, | 475 SkDebugf("%s p1=(%1.9g,%1.9g)<(%1.9g,%1.9g)<(%1.9g,%1.9g)\n", __FUNCTION__, |
| 465 p10.fX, p10.fY, p1Seed.fX, p1Seed.fY, p12.fX, p12.fY); | 476 p10.fX, p10.fY, p1Seed.fX, p1Seed.fY, p12.fX, p12.fY); |
| 466 SkDPoint p20 = quad2.xyAtT(t20); | 477 SkDPoint p20 = quad2.ptAtT(t20); |
| 467 SkDPoint p2Seed = quad2.xyAtT(t2Seed); | 478 SkDPoint p2Seed = quad2.ptAtT(t2Seed); |
| 468 SkDPoint p22 = quad2.xyAtT(t22); | 479 SkDPoint p22 = quad2.ptAtT(t22); |
| 469 SkDebugf("%s p2=(%1.9g,%1.9g)<(%1.9g,%1.9g)<(%1.9g,%1.9g)\n", __FUNCTION__, | 480 SkDebugf("%s p2=(%1.9g,%1.9g)<(%1.9g,%1.9g)<(%1.9g,%1.9g)\n", __FUNCTION__, |
| 470 p20.fX, p20.fY, p2Seed.fX, p2Seed.fY, p22.fX, p22.fY); | 481 p20.fX, p20.fY, p2Seed.fX, p2Seed.fY, p22.fX, p22.fY); |
| 471 #endif | 482 #endif |
| 472 } | 483 } |
| 473 | 484 |
| 474 static void QuadraticIntersection_IntersectionFinder() { | 485 static void QuadraticIntersection_IntersectionFinder() { |
| 475 intersectionFinder(0, 1); | 486 intersectionFinder(0, 1); |
| 476 } | 487 } |
| 477 | 488 |
| 478 static void PathOpsQuadIntersectionTest(skiatest::Reporter* reporter) { | 489 static void PathOpsQuadIntersectionTest(skiatest::Reporter* reporter) { |
| 479 oneOffTests(reporter); | 490 oneOffTests(reporter); |
| 480 coincidentTest(reporter); | 491 coincidentTest(reporter); |
| 481 standardTestCases(reporter); | 492 standardTestCases(reporter); |
| 482 if (false) QuadraticIntersection_IntersectionFinder(); | 493 if (false) QuadraticIntersection_IntersectionFinder(); |
| 483 if (false) QuadraticIntersection_PointFinder(); | 494 if (false) QuadraticIntersection_PointFinder(); |
| 484 } | 495 } |
| 485 | 496 |
| 486 | 497 |
| 487 #include "TestClassDef.h" | 498 #include "TestClassDef.h" |
| 488 DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionTest) | 499 DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionTest) |
| 489 | 500 |
| 490 DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionOneOffTest) | 501 DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionOneOffTest) |
| 502 |
| 503 DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionCoincidenceOneOffTest) |
| OLD | NEW |