diff options
author | 2012-10-31 19:00:20 +0000 | |
---|---|---|
committer | 2012-10-31 19:00:20 +0000 | |
commit | 0b7da433fe0eaa2833d1b2900715b013b36d93da (patch) | |
tree | 818f8a1626bc395beb053b8d47953d2ae5a3cc5d /experimental/Intersection/LineQuadraticIntersection_Test.cpp | |
parent | f94b3a4cebd4adab09c40ebe23c02a615e10c394 (diff) |
shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@6223 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/LineQuadraticIntersection_Test.cpp')
-rw-r--r-- | experimental/Intersection/LineQuadraticIntersection_Test.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/experimental/Intersection/LineQuadraticIntersection_Test.cpp b/experimental/Intersection/LineQuadraticIntersection_Test.cpp index 171a778cb0..69227c3a40 100644 --- a/experimental/Intersection/LineQuadraticIntersection_Test.cpp +++ b/experimental/Intersection/LineQuadraticIntersection_Test.cpp @@ -55,7 +55,41 @@ static int doIntersect(Intersections& intersections, const Quadratic& quad, cons return result; } +static struct oneLineQuad { + Quadratic quad; + _Line line; +} oneOffs[] = { + {{{369.848602,145.680267}, {382.360413,121.298294}, {406.207703,121.298294}}, + {{406.207703,121.298294}, {348.781738,123.864815}}} + }; + +static size_t oneOffs_count = sizeof(oneOffs) / sizeof(oneOffs[0]); + + +static void testOneOffs() { + Intersections intersections; + bool flipped = false; + for (size_t index = 0; index < oneOffs_count; ++index) { + const Quadratic& quad = oneOffs[index].quad; + const _Line& line = oneOffs[index].line; + int result = doIntersect(intersections, quad, line, flipped); + for (int inner = 0; inner < result; ++inner) { + double quadT = intersections.fT[0][inner]; + double quadX, quadY; + xy_at_t(quad, quadT, quadX, quadY); + double lineT = intersections.fT[1][inner]; + double lineX, lineY; + xy_at_t(line, lineT, lineX, lineY); + assert(approximately_equal(quadX, lineX) + && approximately_equal(quadY, lineY)); + } + } +} + void LineQuadraticIntersection_Test() { + if (1) { + testOneOffs(); + } for (size_t index = firstLineQuadIntersectionTest; index < lineQuadTests_count; ++index) { const Quadratic& quad = lineQuadTests[index].quad; const _Line& line = lineQuadTests[index].line; |