Intersection work in progress
Review URL: https://codereview.appspot.com/5576043
git-svn-id: http://skia.googlecode.com/svn/trunk@3087 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/CubicParameterization_Test.cpp b/experimental/Intersection/CubicParameterization_Test.cpp
index 9bb2253..18322c8 100644
--- a/experimental/Intersection/CubicParameterization_Test.cpp
+++ b/experimental/Intersection/CubicParameterization_Test.cpp
@@ -1,5 +1,5 @@
#include "CubicIntersection.h"
-#include "CubicIntersection_Tests.h"
+#include "Intersection_Tests.h"
#include "TestUtilities.h"
const Quadratic quadratics[] = {
@@ -42,3 +42,61 @@
}
}
}
+
+// pairs of coincident cubics
+// The on curve points of each cubic should be on both parameterized cubics.
+const Cubic cubics[] = {
+ {
+ {1, -1},
+ {.333, 1},
+ {-.333, -1},
+ {-1, 1}
+ },
+ {
+ {-1, 1},
+ {-.333, -1},
+ {.333, 1},
+ {1, -1}
+ },
+ {
+ {0, 2},
+ {0, 1},
+ {1, 0},
+ {2, 0}
+ }, {
+ {2, 0},
+ {1, 0},
+ {0, 1},
+ {0, 2}
+ },
+ {
+ {315.74799999999999, 312.83999999999997},
+ {312.64400000000001, 318.13400000000001},
+ {305.83600000000001, 319.90899999999999},
+ {300.54199999999997, 316.80399999999997}
+ }, {
+ {317.12200000000001, 309.05000000000001},
+ {316.11200000000002, 315.10199999999998},
+ {310.38499999999999, 319.19},
+ {304.33199999999999, 318.17899999999997}
+ }
+};
+
+const size_t cubics_count = sizeof(cubics) / sizeof(cubics[0]);
+
+int firstCubicParameterizationTest = 0;
+
+void CubicParameterization_Test() {
+ for (size_t index = firstCubicParameterizationTest; index < cubics_count; ++index) {
+ for (size_t inner = 0; inner < 4; inner += 3) {
+ if (!point_on_parameterized_curve(cubics[index], cubics[index][inner])) {
+ printf("%s [%zu,%zu] 1 parameterization failed\n",
+ __FUNCTION__, index, inner);
+ }
+ if (!point_on_parameterized_curve(cubics[index], cubics[index ^ 1][inner])) {
+ printf("%s [%zu,%zu] 2 parameterization failed\n",
+ __FUNCTION__, index, inner);
+ }
+ }
+ }
+}