shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@3566 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/LineCubicIntersection.cpp b/experimental/Intersection/LineCubicIntersection.cpp
index 500a91e..8517b7e 100644
--- a/experimental/Intersection/LineCubicIntersection.cpp
+++ b/experimental/Intersection/LineCubicIntersection.cpp
@@ -139,7 +139,25 @@
LineCubicIntersections c(cubic, *((_Line*) 0), tRange);
return c.horizontalIntersect(y);
}
-
+
+int horizontalIntersect(const Cubic& cubic, double left, double right, double y,
+ double tRange[3]) {
+ LineCubicIntersections c(cubic, *((_Line*) 0), tRange);
+ int result = c.horizontalIntersect(y);
+ for (int index = 0; index < result; ) {
+ double x, y;
+ xy_at_t(cubic, tRange[index], x, y);
+ if (x < left || x > right) {
+ if (--result > index) {
+ tRange[index] = tRange[result];
+ }
+ continue;
+ }
+ ++index;
+ }
+ return result;
+}
+
int intersect(const Cubic& cubic, const _Line& line, double cRange[3], double lRange[3]) {
LineCubicIntersections c(cubic, line, cRange);
int roots;