blob: 793b796d9ea812fec04b483613e9bb9dbedeb102 [file] [log] [blame]
caryclark@google.comc6825902012-02-03 22:07:47 +00001#include "CurveIntersection.h"
caryclark@google.com27accef2012-01-25 18:57:23 +00002#include "Intersection_Tests.h"
caryclark@google.comc6825902012-02-03 22:07:47 +00003#include "Parameterization_Test.h"
caryclark@google.com639df892012-01-10 21:46:10 +00004
5const Quadratic quadratics[] = {
6 {{0, 0}, {1, 0}, {1, 1}},
7};
8
9const size_t quadratics_count = sizeof(quadratics) / sizeof(quadratics[0]);
10
11int firstQuadraticCoincidenceTest = 0;
12
13void QuadraticCoincidence_Test() {
14 // split large quadratic
15 // compare original, parts, to see if the are coincident
16 for (size_t index = firstQuadraticCoincidenceTest; index < quadratics_count; ++index) {
17 const Quadratic& test = quadratics[index];
18 QuadraticPair split;
19 chop_at(test, split, 0.5);
20 Quadratic midThird;
21 sub_divide(test, 1.0/3, 2.0/3, midThird);
caryclark@google.com27accef2012-01-25 18:57:23 +000022 const Quadratic* quads[] = {
23 &test, &midThird, &split.first(), &split.second()
24 };
25 size_t quadsCount = sizeof(quads) / sizeof(quads[0]);
26 for (size_t one = 0; one < quadsCount; ++one) {
27 for (size_t two = 0; two < quadsCount; ++two) {
28 for (size_t inner = 0; inner < 3; inner += 2) {
29 if (!point_on_parameterized_curve(*quads[one], (*quads[two])[inner])) {
rmistry@google.comd6176b02012-08-23 18:14:13 +000030 printf("%s %zu [%zu,%zu] %zu parameterization failed\n",
caryclark@google.com27accef2012-01-25 18:57:23 +000031 __FUNCTION__, index, one, two, inner);
32 }
33 }
34 if (!implicit_matches(*quads[one], *quads[two])) {
35 printf("%s %zu [%zu,%zu] coincidence failed\n", __FUNCTION__,
36 index, one, two);
37 }
38 }
caryclark@google.com639df892012-01-10 21:46:10 +000039 }
40 }
41}