shape ops work in progress
add quartic solution for intersecting quadratics
git-svn-id: http://skia.googlecode.com/svn/trunk@5541 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/QuadraticBezierClip.cpp b/experimental/Intersection/QuadraticBezierClip.cpp
index 6df2d1b..6100914 100644
--- a/experimental/Intersection/QuadraticBezierClip.cpp
+++ b/experimental/Intersection/QuadraticBezierClip.cpp
@@ -9,6 +9,8 @@
#include "LineParameters.h"
#include <algorithm> // used for std::swap
+#define DEBUG_BEZIER_CLIP 1
+
// return false if unable to clip (e.g., unable to create implicit line)
// caller should subdivide, or create degenerate if the values are too small
bool bezier_clip(const Quadratic& q1, const Quadratic& q2, double& minT, double& maxT) {
@@ -65,5 +67,17 @@
x_at(distance2y[idx], distance2y[next], top, bottom, flags, minT, maxT);
idx = next;
} while (idx);
+#if DEBUG_BEZIER_CLIP
+ _Rect r1, r2;
+ r1.setBounds(q1);
+ r2.setBounds(q2);
+ _Point testPt = {0.487, 0.337};
+ if (r1.contains(testPt) && r2.contains(testPt)) {
+ printf("%s q1=(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g)"
+ " q2=(%1.9g,%1.9g %1.9g,%1.9g %1.9g,%1.9g) minT=%1.9g maxT=%1.9g\n",
+ __FUNCTION__, q1[0].x, q1[0].y, q1[1].x, q1[1].y, q1[2].x, q1[2].y,
+ q2[0].x, q2[0].y, q2[1].x, q2[1].y, q2[2].x, q2[2].y, minT, maxT);
+ }
+#endif
return minT < maxT; // returns false if distance shows no intersection
}