diff options
author | 2012-08-31 20:55:07 +0000 | |
---|---|---|
committer | 2012-08-31 20:55:07 +0000 | |
commit | 32546db1494a6c6433a7919844133a6ff5b5c7b2 (patch) | |
tree | 80654e63402d6dc36ae41eb0f6a7a337f278864e /experimental/Intersection/QuadraticIntersection_Test.cpp | |
parent | d7e27822030b5ab7729e32c6d29227210dfe88ab (diff) |
shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@5376 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/QuadraticIntersection_Test.cpp')
-rw-r--r-- | experimental/Intersection/QuadraticIntersection_Test.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/experimental/Intersection/QuadraticIntersection_Test.cpp b/experimental/Intersection/QuadraticIntersection_Test.cpp index 3377950989..74037be7eb 100644 --- a/experimental/Intersection/QuadraticIntersection_Test.cpp +++ b/experimental/Intersection/QuadraticIntersection_Test.cpp @@ -94,7 +94,35 @@ static void oneOffTest() { } } +static const Quadratic coincidentTestSet[] = { + {{8, 8}, {10, 10}, {8, -10}}, + {{8, -10}, {10, 10}, {8, 8}}, +}; + +const size_t coincidentTestSetCount = sizeof(coincidentTestSet) / sizeof(coincidentTestSet[0]); + +static void coincidentTest() { + for (size_t testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex += 2) { + const Quadratic& quad1 = coincidentTestSet[testIndex]; + const Quadratic& quad2 = coincidentTestSet[testIndex + 1]; + Intersections intersections; + intersect(quad1, quad2, intersections); + SkASSERT(intersections.coincidentUsed() == 2); + for (int pt = 0; pt < intersections.coincidentUsed(); ++pt) { + double tt1 = intersections.fT[0][pt]; + double tx1, ty1; + xy_at_t(quad1, tt1, tx1, ty1); + double tt2 = intersections.fT[1][pt]; + double tx2, ty2; + xy_at_t(quad2, tt2, tx2, ty2); + SkDebugf("%s [%d,%d] t1=%g (%g,%g) t2=%g (%g,%g)\n", + __FUNCTION__, (int)testIndex, pt, tt1, tx1, ty1, tt2, tx2, ty2); + } + } +} + void QuadraticIntersection_Test() { + coincidentTest(); oneOffTest(); standardTestCases(); } |