caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2012 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "PathOpsQuadIntersectionTestData.h" |
| 9 | |
caryclark | a35ab3e | 2016-10-20 08:32:18 -0700 | [diff] [blame] | 10 | const QuadPts quadraticPoints[] = { |
caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 11 | {{{0, 0}, {1, 0}, {0, 0}}}, |
| 12 | {{{0, 0}, {0, 1}, {0, 0}}}, |
| 13 | {{{0, 0}, {1, 1}, {0, 0}}}, |
| 14 | {{{1, 1}, {2, 2}, {1, 1}}}, |
| 15 | }; |
| 16 | |
caryclark@google.com | ad65a3e | 2013-04-15 19:13:59 +0000 | [diff] [blame] | 17 | const size_t quadraticPoints_count = SK_ARRAY_COUNT(quadraticPoints); |
caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 18 | |
caryclark | a35ab3e | 2016-10-20 08:32:18 -0700 | [diff] [blame] | 19 | const QuadPts quadraticLines[] = { |
caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 20 | {{{0, 0}, {0, 0}, {1, 0}}}, |
| 21 | {{{1, 0}, {0, 0}, {0, 0}}}, |
| 22 | {{{1, 0}, {2, 0}, {3, 0}}}, |
| 23 | {{{0, 0}, {0, 0}, {0, 1}}}, |
| 24 | {{{0, 1}, {0, 0}, {0, 0}}}, |
| 25 | {{{0, 1}, {0, 2}, {0, 3}}}, |
| 26 | {{{0, 0}, {0, 0}, {1, 1}}}, |
| 27 | {{{1, 1}, {0, 0}, {0, 0}}}, |
| 28 | {{{1, 1}, {2, 2}, {3, 3}}}, |
| 29 | {{{1, 1}, {3, 3}, {3, 3}}}, |
| 30 | {{{1, 1}, {1, 1}, {2, 2}}}, |
| 31 | {{{1, 1}, {1, 1}, {3, 3}}}, |
| 32 | {{{1, 1}, {2, 2}, {4, 4}}}, // no coincident |
| 33 | {{{1, 1}, {3, 3}, {4, 4}}}, |
| 34 | {{{1, 1}, {3, 3}, {2, 2}}}, |
| 35 | {{{1, 1}, {4, 4}, {2, 2}}}, |
| 36 | {{{1, 1}, {4, 4}, {3, 3}}}, |
| 37 | {{{2, 2}, {1, 1}, {3, 3}}}, |
| 38 | {{{2, 2}, {1, 1}, {4, 4}}}, |
| 39 | {{{2, 2}, {3, 3}, {1, 1}}}, |
| 40 | {{{2, 2}, {3, 3}, {4, 4}}}, |
| 41 | {{{2, 2}, {4, 4}, {1, 1}}}, |
| 42 | {{{2, 2}, {4, 4}, {3, 3}}}, |
| 43 | }; |
| 44 | |
caryclark@google.com | ad65a3e | 2013-04-15 19:13:59 +0000 | [diff] [blame] | 45 | const size_t quadraticLines_count = SK_ARRAY_COUNT(quadraticLines); |
caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 46 | |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 47 | static const double F = FLT_EPSILON * 32; |
| 48 | static const double H = FLT_EPSILON * 32; |
| 49 | static const double J = FLT_EPSILON * 32; |
| 50 | static const double K = FLT_EPSILON * 32; // INVESTIGATE: why are larger multiples necessary? |
caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 51 | |
caryclark | a35ab3e | 2016-10-20 08:32:18 -0700 | [diff] [blame] | 52 | const QuadPts quadraticModEpsilonLines[] = { |
caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 53 | {{{0, F}, {0, 0}, {1, 0}}}, |
| 54 | {{{0, 0}, {1, 0}, {0, F}}}, |
| 55 | {{{1, 0}, {0, F}, {0, 0}}}, |
| 56 | {{{1, H}, {2, 0}, {3, 0}}}, |
caryclark@google.com | 7eaa53d | 2013-10-02 14:49:34 +0000 | [diff] [blame] | 57 | // {{{F, 0}, {0, 0}, {0, 1}}}, // INVESTIGATE: even substituting K for F, quad is still linear. |
| 58 | // {{{0, 0}, {0, 1}, {F, 0}}}, |
| 59 | // {{{0, 1}, {F, 0}, {0, 0}}}, |
| 60 | // {{{H, 1}, {0, 2}, {0, 3}}}, |
caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 61 | {{{0, F}, {0, 0}, {1, 1}}}, |
| 62 | {{{0, 0}, {1, 1}, {F, 0}}}, |
| 63 | {{{1, 1}, {F, 0}, {0, 0}}}, |
| 64 | {{{1, 1+J}, {2, 2}, {3, 3}}}, |
| 65 | {{{1, 1}, {3, 3}, {3+F, 3}}}, |
| 66 | {{{1, 1}, {1+F, 1}, {2, 2}}}, |
caryclark | 5435929 | 2015-03-26 07:52:43 -0700 | [diff] [blame] | 67 | {{{1, 1}, {2, 2}, {1, 1+K}}}, |
caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 68 | {{{1, 1}, {1, 1+F}, {3, 3}}}, |
| 69 | {{{1+H, 1}, {2, 2}, {4, 4}}}, // no coincident |
| 70 | {{{1, 1+K}, {3, 3}, {4, 4}}}, |
| 71 | {{{1, 1}, {3+F, 3}, {2, 2}}}, |
| 72 | {{{1, 1}, {4, 4+F}, {2, 2}}}, |
| 73 | {{{1, 1}, {4, 4}, {3+F, 3}}}, |
| 74 | {{{2, 2}, {1, 1}, {3, 3+F}}}, |
| 75 | {{{2+F, 2}, {1, 1}, {4, 4}}}, |
| 76 | {{{2, 2+F}, {3, 3}, {1, 1}}}, |
| 77 | {{{2, 2}, {3+F, 3}, {4, 4}}}, |
| 78 | {{{2, 2}, {4, 4+F}, {1, 1}}}, |
| 79 | {{{2, 2}, {4, 4}, {3+F, 3}}}, |
| 80 | }; |
| 81 | |
| 82 | const size_t quadraticModEpsilonLines_count = |
caryclark@google.com | ad65a3e | 2013-04-15 19:13:59 +0000 | [diff] [blame] | 83 | SK_ARRAY_COUNT(quadraticModEpsilonLines); |
caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 84 | |
caryclark | a35ab3e | 2016-10-20 08:32:18 -0700 | [diff] [blame] | 85 | const QuadPts quadraticTests[][2] = { |
caryclark@google.com | 9166dcb | 2013-04-08 11:50:00 +0000 | [diff] [blame] | 86 | { // one intersection |
| 87 | {{{0, 0}, |
| 88 | {0, 1}, |
| 89 | {1, 1}}}, |
| 90 | {{{0, 1}, |
| 91 | {0, 0}, |
| 92 | {1, 0}}} |
| 93 | }, |
| 94 | { // four intersections |
| 95 | {{{1, 0}, |
| 96 | {2, 6}, |
| 97 | {3, 0}}}, |
| 98 | {{{0, 1}, |
| 99 | {6, 2}, |
| 100 | {0, 3}}} |
| 101 | } |
| 102 | }; |
| 103 | |
caryclark@google.com | ad65a3e | 2013-04-15 19:13:59 +0000 | [diff] [blame] | 104 | const size_t quadraticTests_count = SK_ARRAY_COUNT(quadraticTests); |