work in progress for shape operations

A    experimental/Intersection
A    experimental/Intersection/Intersections.h
A    experimental/Intersection/DataTypes.cpp
A    experimental/Intersection/QuadraticReduceOrder.cpp
A    experimental/Intersection/IntersectionUtilities.cpp
A    experimental/Intersection/CubicIntersection_Tests.h
A    experimental/Intersection/LineParameteters_Test.cpp
A    experimental/Intersection/ReduceOrder.cpp
A    experimental/Intersection/QuadraticIntersection.cpp
A    experimental/Intersection/Extrema.h
A    experimental/Intersection/CubicIntersection_TestData.h
A    experimental/Intersection/QuadraticParameterization_Test.cpp
A    experimental/Intersection/TestUtilities.cpp
A    experimental/Intersection/CubicRoots.cpp
A    experimental/Intersection/QuadraticParameterization.cpp
A    experimental/Intersection/QuadraticSubDivide.cpp
A    experimental/Intersection/LineIntersection_Test.cpp
A    experimental/Intersection/LineIntersection.cpp
A    experimental/Intersection/CubicParameterizationCode.cpp
A    experimental/Intersection/LineParameters.h
A    experimental/Intersection/CubicIntersection.h
A    experimental/Intersection/CubeRoot.cpp
A    experimental/Intersection/SkAntiEdge.h
A    experimental/Intersection/ConvexHull_Test.cpp
A    experimental/Intersection/CubicBezierClip_Test.cpp
A    experimental/Intersection/CubicIntersection_Tests.cpp
A    experimental/Intersection/CubicBezierClip.cpp
A    experimental/Intersection/CubicIntersectionT.cpp
A    experimental/Intersection/Inline_Tests.cpp
A    experimental/Intersection/ReduceOrder_Test.cpp
A    experimental/Intersection/QuadraticIntersection_TestData.h
A    experimental/Intersection/DataTypes.h
A    experimental/Intersection/Extrema.cpp
A    experimental/Intersection/EdgeApp.cpp
A    experimental/Intersection/CubicIntersection_TestData.cpp
A    experimental/Intersection/IntersectionUtilities.h
A    experimental/Intersection/CubicReduceOrder.cpp
A    experimental/Intersection/CubicCoincidence.cpp
A    experimental/Intersection/CubicIntersection_Test.cpp
A    experimental/Intersection/CubicIntersection.cpp
A    experimental/Intersection/QuadraticUtilities.h
A    experimental/Intersection/SkAntiEdge.cpp
A    experimental/Intersection/TestUtilities.h
A    experimental/Intersection/CubicParameterization_Test.cpp
A    experimental/Intersection/LineIntersection.h
A    experimental/Intersection/CubicSubDivide.cpp
A    experimental/Intersection/CubicParameterization.cpp
A    experimental/Intersection/QuadraticBezierClip_Test.cpp
A    experimental/Intersection/QuadraticBezierClip.cpp
A    experimental/Intersection/BezierClip_Test.cpp
A    experimental/Intersection/ConvexHull.cpp
A    experimental/Intersection/BezierClip.cpp
A    experimental/Intersection/QuadraticIntersection_TestData.cpp



git-svn-id: http://skia.googlecode.com/svn/trunk@3005 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/CubicIntersection_Test.cpp b/experimental/Intersection/CubicIntersection_Test.cpp
new file mode 100644
index 0000000..0ae1749
--- /dev/null
+++ b/experimental/Intersection/CubicIntersection_Test.cpp
@@ -0,0 +1,65 @@
+#include "CubicIntersection.h"
+#include "CubicIntersection_TestData.h"
+#include "CubicIntersection_Tests.h"
+#include "Intersections.h"
+#include "TestUtilities.h"
+
+const int firstCubicIntersectionTest = 9;
+
+void CubicIntersection_Test() {
+    for (size_t index = firstCubicIntersectionTest; index < tests_count; ++index) {
+        const Cubic& cubic1 = tests[index][0];
+        const Cubic& cubic2 = tests[index][1];
+        Cubic reduce1, reduce2;
+        int order1 = reduceOrder(cubic1, reduce1, kReduceOrder_NoQuadraticsAllowed);
+        int order2 = reduceOrder(cubic2, reduce2, kReduceOrder_NoQuadraticsAllowed);
+        if (order1 < 4) {
+            printf("[%d] cubic1 order=%d\n", (int) index, order1);
+        }
+        if (order2 < 4) {
+            printf("[%d] cubic2 order=%d\n", (int) index, order2);
+        }
+        if (order1 == 4 && order2 == 4) {
+            Intersections tIntersections;
+            intersectStartT(reduce1, reduce2, tIntersections);
+#ifdef COMPUTE_BY_CUBIC_SUBDIVISION
+            Intersections intersections;
+            intersectStart(reduce1, reduce2, intersections);
+#endif
+            if (tIntersections.intersected()) {
+                for (int pt = 0; pt < tIntersections.used(); ++pt) {
+#ifdef COMPUTE_BY_CUBIC_SUBDIVISION
+                    double t1 = intersections.fT[0][pt];
+                    double x1, y1;
+                    xy_at_t(cubic1, t1, x1, y1);
+                    double t2 = intersections.fT[1][pt];
+                    double x2, y2;
+                    xy_at_t(cubic2, t2, x2, y2);
+                    if (!approximately_equal(x1, x2)) {
+                        printf("%s [%d] (1) t1=%g (%g,%g) t2=%g (%g,%g)\n",
+                            __FUNCTION__, pt, t1, x1, y1, t2, x2, y2);
+                    }
+                    if (!approximately_equal(y1, y2)) {
+                        printf("%s [%d] (2) t1=%g (%g,%g) t2=%g (%g,%g)\n",
+                            __FUNCTION__, pt, t1, x1, y1, t2, x2, y2);
+                    }
+#endif
+                    double tt1 = tIntersections.fT[0][pt];
+                    double tx1, ty1;
+                    xy_at_t(cubic1, tt1, tx1, ty1);
+                    double tt2 = tIntersections.fT[1][pt];
+                    double tx2, ty2;
+                    xy_at_t(cubic2, tt2, tx2, ty2);
+                    if (!approximately_equal(tx1, tx2)) {
+                        printf("%s [%d,%d] x!= t1=%g (%g,%g) t2=%g (%g,%g)\n",
+                            __FUNCTION__, (int)index, pt, tt1, tx1, ty1, tt2, tx2, ty2);
+                    }
+                    if (!approximately_equal(ty1, ty2)) {
+                        printf("%s [%d,%d] y!= t1=%g (%g,%g) t2=%g (%g,%g)\n",
+                            __FUNCTION__, (int)index, pt, tt1, tx1, ty1, tt2, tx2, ty2);
+                    }
+                }
+            }
+        }
+    }
+}