| OLD | NEW |
| (Empty) |
| 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 #include "CurveIntersection.h" | |
| 8 #include "Intersection_Tests.h" | |
| 9 #include "Parameterization_Test.h" | |
| 10 #include "QuadraticUtilities.h" | |
| 11 | |
| 12 const Quadratic quadratics[] = { | |
| 13 {{0, 0}, {1, 0}, {1, 1}}, | |
| 14 }; | |
| 15 | |
| 16 const size_t quadratics_count = sizeof(quadratics) / sizeof(quadratics[0]); | |
| 17 | |
| 18 int firstQuadraticCoincidenceTest = 0; | |
| 19 | |
| 20 void QuadraticCoincidence_Test() { | |
| 21 // split large quadratic | |
| 22 // compare original, parts, to see if the are coincident | |
| 23 for (size_t index = firstQuadraticCoincidenceTest; index < quadratics_count;
++index) { | |
| 24 const Quadratic& test = quadratics[index]; | |
| 25 QuadraticPair split; | |
| 26 chop_at(test, split, 0.5); | |
| 27 Quadratic midThird; | |
| 28 sub_divide(test, 1.0/3, 2.0/3, midThird); | |
| 29 const Quadratic* quads[] = { | |
| 30 &test, &midThird, &split.first(), &split.second() | |
| 31 }; | |
| 32 size_t quadsCount = sizeof(quads) / sizeof(quads[0]); | |
| 33 for (size_t one = 0; one < quadsCount; ++one) { | |
| 34 for (size_t two = 0; two < quadsCount; ++two) { | |
| 35 for (size_t inner = 0; inner < 3; inner += 2) { | |
| 36 if (!point_on_parameterized_curve(*quads[one], (*quads[two])
[inner])) { | |
| 37 SkDebugf("%s %zu [%zu,%zu] %zu parameterization fail
ed\n", | |
| 38 __FUNCTION__, index, one, two, inner); | |
| 39 } | |
| 40 } | |
| 41 if (!implicit_matches(*quads[one], *quads[two])) { | |
| 42 SkDebugf("%s %zu [%zu,%zu] coincidence failed\n", __FUNCTION
__, | |
| 43 index, one, two); | |
| 44 } | |
| 45 } | |
| 46 } | |
| 47 } | |
| 48 } | |
| OLD | NEW |