caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame^] | 1 | #include "CubicIntersection.h" |
| 2 | #include "CubicIntersection_Tests.h" |
| 3 | |
| 4 | const Quadratic quadratics[] = { |
| 5 | {{0, 0}, {1, 0}, {1, 1}}, |
| 6 | }; |
| 7 | |
| 8 | const size_t quadratics_count = sizeof(quadratics) / sizeof(quadratics[0]); |
| 9 | |
| 10 | int firstQuadraticCoincidenceTest = 0; |
| 11 | |
| 12 | void QuadraticCoincidence_Test() { |
| 13 | // split large quadratic |
| 14 | // compare original, parts, to see if the are coincident |
| 15 | for (size_t index = firstQuadraticCoincidenceTest; index < quadratics_count; ++index) { |
| 16 | const Quadratic& test = quadratics[index]; |
| 17 | QuadraticPair split; |
| 18 | chop_at(test, split, 0.5); |
| 19 | Quadratic midThird; |
| 20 | sub_divide(test, 1.0/3, 2.0/3, midThird); |
| 21 | if (!implicit_matches(test, split.first())) { |
| 22 | printf("%s-1 %d", __FUNCTION__, (int)index); |
| 23 | } |
| 24 | if (!implicit_matches(test, split.second())) { |
| 25 | printf("%s-2 %d", __FUNCTION__, (int)index); |
| 26 | } |
| 27 | if (!implicit_matches(midThird, split.first())) { |
| 28 | printf("%s-3 %d", __FUNCTION__, (int)index); |
| 29 | } |
| 30 | if (!implicit_matches(midThird, split.second())) { |
| 31 | printf("%s-4 %d", __FUNCTION__, (int)index); |
| 32 | } |
| 33 | if (!implicit_matches(split.first(), split.second())) { |
| 34 | printf("%s-5 %d", __FUNCTION__, (int)index); |
| 35 | } |
| 36 | } |
| 37 | } |