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 | 7 |
8 #include "PathOpsCubicIntersectionTestData.h" | 8 #include "PathOpsCubicIntersectionTestData.h" |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
(...skipping 28 matching lines...) Expand all Loading... |
39 {{{0, 0}, {1, 1}, {N, 0}, {0, 0}}}, | 39 {{{0, 0}, {1, 1}, {N, 0}, {0, 0}}}, |
40 {{{0, 0}, {D, 0}, {1, 1}, {0, 0}}}, | 40 {{{0, 0}, {D, 0}, {1, 1}, {0, 0}}}, |
41 {{{0, 0}, {1, 1}, {D, 0}, {0, 0}}}, | 41 {{{0, 0}, {1, 1}, {D, 0}, {0, 0}}}, |
42 {{{0, 0}, {N, 0}, {1, 1}, {0, 0}}}, | 42 {{{0, 0}, {N, 0}, {1, 1}, {0, 0}}}, |
43 {{{1, 1}, {2, 2}, {2, 2+N}, {1, 1}}}, | 43 {{{1, 1}, {2, 2}, {2, 2+N}, {1, 1}}}, |
44 }; | 44 }; |
45 | 45 |
46 const size_t pointDegenerates_count = SK_ARRAY_COUNT(pointDegenerates); | 46 const size_t pointDegenerates_count = SK_ARRAY_COUNT(pointDegenerates); |
47 | 47 |
48 const SkDCubic notPointDegenerates[] = { | 48 const SkDCubic notPointDegenerates[] = { |
49 {{{1 + FLT_EPSILON * 2, 1}, {1, FLT_EPSILON * 2}, {1, 1}, {1, 1}}}, | 49 {{{1 + FLT_EPSILON * 8, 1}, {1, FLT_EPSILON * 8}, {1, 1}, {1, 1}}}, |
50 {{{1 + FLT_EPSILON * 2, 1}, {1 - FLT_EPSILON * 2, 1}, {1, 1}, {1, 1}}} | 50 {{{1 + FLT_EPSILON * 8, 1}, {1 - FLT_EPSILON * 8, 1}, {1, 1}, {1, 1}}} |
51 }; | 51 }; |
52 | 52 |
53 const size_t notPointDegenerates_count = | 53 const size_t notPointDegenerates_count = |
54 SK_ARRAY_COUNT(notPointDegenerates); | 54 SK_ARRAY_COUNT(notPointDegenerates); |
55 | 55 |
56 // from http://www.truetex.com/bezint.htm | 56 // from http://www.truetex.com/bezint.htm |
57 const SkDCubic tests[][2] = { | 57 const SkDCubic tests[][2] = { |
58 { // intersects in one place (data gives bezier clip fits | 58 { // intersects in one place (data gives bezier clip fits |
59 {{{0, 45}, | 59 {{{0, 45}, |
60 {6.0094158284751593, 51.610357411322688}, | 60 {6.0094158284751593, 51.610357411322688}, |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 {{{0, 0}, {0, 0}, {0, 1}, {1, 0}}}, | 149 {{{0, 0}, {0, 0}, {0, 1}, {1, 0}}}, |
150 {{{0, 0}, {0, 1}, {0, 0}, {1, 0}}}, | 150 {{{0, 0}, {0, 1}, {0, 0}, {1, 0}}}, |
151 {{{0, 0}, {0, 1}, {1, 0}, {0, 0}}}, | 151 {{{0, 0}, {0, 1}, {1, 0}, {0, 0}}}, |
152 {{{0, 1}, {0, 0}, {0, 0}, {1, 0}}}, | 152 {{{0, 1}, {0, 0}, {0, 0}, {1, 0}}}, |
153 {{{0, 1}, {0, 0}, {1, 0}, {0, 0}}}, | 153 {{{0, 1}, {0, 0}, {1, 0}, {0, 0}}}, |
154 {{{0, 1}, {1, 0}, {0, 0}, {0, 0}}}, | 154 {{{0, 1}, {1, 0}, {0, 0}, {0, 0}}}, |
155 }; | 155 }; |
156 | 156 |
157 const size_t notLines_count = SK_ARRAY_COUNT(notLines); | 157 const size_t notLines_count = SK_ARRAY_COUNT(notLines); |
158 | 158 |
159 static const double E = FLT_EPSILON * 2; | 159 static const double E = FLT_EPSILON * 8; |
160 static const double F = FLT_EPSILON * 3; | 160 static const double F = FLT_EPSILON * 8; |
161 | 161 |
162 const SkDCubic modEpsilonLines[] = { | 162 const SkDCubic modEpsilonLines[] = { |
163 {{{0, E}, {0, 0}, {0, 0}, {1, 0}}}, // horizontal | 163 {{{0, E}, {0, 0}, {0, 0}, {1, 0}}}, // horizontal |
164 {{{0, 0}, {0, E}, {1, 0}, {0, 0}}}, | 164 {{{0, 0}, {0, E}, {1, 0}, {0, 0}}}, |
165 {{{0, 0}, {1, 0}, {0, E}, {0, 0}}}, | 165 {{{0, 0}, {1, 0}, {0, E}, {0, 0}}}, |
166 {{{1, 0}, {0, 0}, {0, 0}, {0, E}}}, | 166 {{{1, 0}, {0, 0}, {0, 0}, {0, E}}}, |
167 {{{1, E}, {2, 0}, {3, 0}, {4, 0}}}, | 167 {{{1, E}, {2, 0}, {3, 0}, {4, 0}}}, |
168 {{{E, 0}, {0, 0}, {0, 0}, {0, 1}}}, // vertical | 168 {{{E, 0}, {0, 0}, {0, 0}, {0, 1}}}, // vertical |
169 {{{0, 0}, {E, 0}, {0, 1}, {0, 0}}}, | 169 {{{0, 0}, {E, 0}, {0, 1}, {0, 0}}}, |
170 {{{0, 0}, {0, 1}, {E, 0}, {0, 0}}}, | 170 {{{0, 0}, {0, 1}, {E, 0}, {0, 0}}}, |
171 {{{0, 1}, {0, 0}, {0, 0}, {E, 0}}}, | 171 {{{0, 1}, {0, 0}, {0, 0}, {E, 0}}}, |
172 {{{E, 1}, {0, 2}, {0, 3}, {0, 4}}}, | 172 {{{E, 1}, {0, 2}, {0, 3}, {0, 4}}}, |
173 {{{E, 0}, {0, 0}, {0, 0}, {1, 1}}}, // 3 coincident | 173 {{{E, 0}, {0, 0}, {0, 0}, {1, 1}}}, // 3 coincident |
174 {{{0, 0}, {E, 0}, {1, 1}, {0, 0}}}, | 174 {{{0, 0}, {E, 0}, {1, 1}, {0, 0}}}, |
175 {{{0, 0}, {1, 1}, {E, 0}, {0, 0}}}, | 175 {{{0, 0}, {1, 1}, {E, 0}, {0, 0}}}, |
176 {{{1, 1}, {0, 0}, {0, 0}, {E, 0}}}, | 176 {{{1, 1}, {0, 0}, {0, 0}, {E, 0}}}, |
177 {{{0, E}, {0, 0}, {1, 1}, {2, 2}}}, // 2 coincident | 177 {{{0, E}, {0, 0}, {1, 1}, {2, 2}}}, // 2 coincident |
178 {{{0, 0}, {1, 1}, {0, E}, {2, 2}}}, | 178 {{{0, 0}, {1, 1}, {0, E}, {2, 2}}}, |
179 {{{0, 0}, {1, 1}, {2, 2}, {0, E}}}, | 179 {{{0, 0}, {1, 1}, {2, 2}, {0, E}}}, |
180 {{{1, 1}, {0, E}, {0, 0}, {2, 2}}}, | 180 {{{1, 1}, {0, E}, {0, 0}, {2, 2}}}, |
181 {{{1, 1}, {0, E}, {2, 2}, {0, 0}}}, | 181 {{{1, 1}, {0, E}, {2, 2}, {0, 0}}}, |
182 {{{1, 1}, {2, 2}, {E, 0}, {0, 0}}}, | 182 {{{1, 1}, {2, 2}, {E, 0}, {0, 0}}}, |
183 {{{1, 1}, {2, 2+E}, {3, 3}, {2, 2}}}, // middle-last coincident | 183 {{{1, 1}, {2, 2+E}, {3, 3}, {2, 2}}}, // middle-last coincident |
184 {{{1, 1}, {2+E, 2}, {3, 3}, {3, 3}}}, // middle-last coincident | 184 {{{1, 1}, {2+E, 2}, {3, 3}, {3, 3}}}, // middle-last coincident |
185 {{{1, 1}, {1, 1}, {2, 2}, {2+E, 2}}}, // 2 pairs coincident | 185 {{{1, 1}, {1, 1}, {2, 2}, {2+E, 2}}}, // 2 pairs coincident |
186 {{{1, 1}, {2, 2}, {1, 1}, {2+E, 2}}}, | 186 {{{1, 1}, {2, 2}, {1, 1}, {2+E, 2}}}, |
187 {{{1, 1}, {2, 2}, {2, 2+E}, {1, 1}}}, | 187 {{{1, 1}, {2, 2}, {2, 2+E}, {1, 1}}}, |
188 {{{1, 1}, {1, 1+E}, {3, 3}, {3, 3}}}, // first-middle middle-last coinciden
t | 188 {{{1, 1}, {1, 1+E}, {3, 3}, {3, 3}}}, // first-middle middle-last coinciden
t |
189 {{{1, 1}, {2+E, 2}, {3, 3}, {4, 4}}}, // no coincident | 189 {{{1, 1}, {2+E, 2}, {3, 3}, {4, 4}}}, // no coincident |
190 {{{1, 1}, {3, 3}, {2, 2}, {4, 4+F}}}, // INVESTIGATE: why the epsilon is bi
gger | 190 {{{1, 1}, {3, 3}, {2, 2}, {4, 4+F+F}}}, // INVESTIGATE: why the epsilon is
bigger |
191 {{{1, 1+F}, {2, 2}, {4, 4}, {3, 3}}}, // INVESTIGATE: why the epsilon is bi
gger | 191 {{{1, 1+F+F}, {2, 2}, {4, 4}, {3, 3}}}, // INVESTIGATE: why the epsilon is
bigger |
192 {{{1, 1}, {3, 3}, {4, 4+E}, {2, 2}}}, | 192 {{{1, 1}, {3, 3}, {4, 4+E}, {2, 2}}}, |
193 {{{1, 1}, {4, 4}, {2, 2}, {3, 3+E}}}, | 193 {{{1, 1}, {4, 4}, {2, 2}, {3, 3+E}}}, |
194 {{{1, 1}, {4, 4}, {3, 3}, {2+E, 2}}}, | 194 {{{1, 1}, {4, 4}, {3, 3}, {2+E, 2}}}, |
195 {{{2, 2}, {1, 1}, {3+E, 3}, {4, 4}}}, | 195 {{{2, 2}, {1, 1}, {3+E, 3}, {4, 4}}}, |
196 {{{2, 2}, {1+E, 1}, {4, 4}, {3, 3}}}, | 196 {{{2, 2}, {1+E, 1}, {4, 4}, {3, 3}}}, |
197 {{{2, 2+E}, {3, 3}, {1, 1}, {4, 4}}}, | 197 {{{2, 2+E}, {3, 3}, {1, 1}, {4, 4}}}, |
198 {{{2+E, 2}, {3, 3}, {4, 4}, {1, 1}}}, | 198 {{{2+E, 2}, {3, 3}, {4, 4}, {1, 1}}}, |
199 {{{2, 2}, {4+E, 4}, {1, 1}, {3, 3}}}, | 199 {{{2, 2}, {4+E, 4}, {1, 1}, {3, 3}}}, |
200 {{{2, 2}, {4, 4}, {3, 3}, {1, 1+E}}}, | 200 {{{2, 2}, {4, 4}, {3, 3}, {1, 1+E}}}, |
201 }; | 201 }; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 {{{1, 1}, {4, 4}, {3, 3}, {2+M, 2}}}, // INVESTIGATE: why the epsilon is sm
aller | 266 {{{1, 1}, {4, 4}, {3, 3}, {2+M, 2}}}, // INVESTIGATE: why the epsilon is sm
aller |
267 {{{2, 2}, {1, 1}, {3+N, 3}, {4, 4}}}, | 267 {{{2, 2}, {1, 1}, {3+N, 3}, {4, 4}}}, |
268 {{{2, 2}, {1+N, 1}, {4, 4}, {3, 3}}}, | 268 {{{2, 2}, {1+N, 1}, {4, 4}, {3, 3}}}, |
269 {{{2, 2+N}, {3, 3}, {1, 1}, {4, 4}}}, | 269 {{{2, 2+N}, {3, 3}, {1, 1}, {4, 4}}}, |
270 {{{2+M, 2}, {3, 3}, {4, 4}, {1, 1}}}, // INVESTIGATE: why the epsilon is sm
aller | 270 {{{2+M, 2}, {3, 3}, {4, 4}, {1, 1}}}, // INVESTIGATE: why the epsilon is sm
aller |
271 {{{2, 2}, {4+N, 4}, {1, 1}, {3, 3}}}, | 271 {{{2, 2}, {4+N, 4}, {1, 1}, {3, 3}}}, |
272 {{{2, 2}, {4, 4}, {3, 3}, {1, 1+N}}}, | 272 {{{2, 2}, {4, 4}, {3, 3}, {1, 1+N}}}, |
273 }; | 273 }; |
274 | 274 |
275 const size_t negEpsilonLines_count = SK_ARRAY_COUNT(negEpsilonLines); | 275 const size_t negEpsilonLines_count = SK_ARRAY_COUNT(negEpsilonLines); |
OLD | NEW |