shape ops work in progress
working on quad/quad intersection
git-svn-id: http://skia.googlecode.com/svn/trunk@5326 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/Intersections.h b/experimental/Intersection/Intersections.h
index f855c45..c1e1ce9 100644
--- a/experimental/Intersection/Intersections.h
+++ b/experimental/Intersection/Intersections.h
@@ -11,9 +11,12 @@
public:
Intersections()
: fUsed(0)
+ , fCoincidentUsed(0)
, fSwap(0)
{
+ // OPTIMIZE: don't need to be initialized in release
bzero(fT, sizeof(fT));
+ bzero(fCoincidentT, sizeof(fCoincidentT));
}
void add(double one, double two) {
@@ -26,6 +29,19 @@
++fUsed;
}
+ // start if index == 0 : end if index == 1
+ void addCoincident(double one, double two) {
+ if (fCoincidentUsed > 0
+ && approximately_equal(fCoincidentT[fSwap][fCoincidentUsed - 1], one)
+ && approximately_equal(fCoincidentT[fSwap ^ 1][fCoincidentUsed - 1], two)) {
+ --fCoincidentUsed;
+ return;
+ }
+ fCoincidentT[fSwap][fCoincidentUsed] = one;
+ fCoincidentT[fSwap ^ 1][fCoincidentUsed] = two;
+ ++fCoincidentUsed;
+ }
+
void offset(int base, double start, double end) {
for (int index = base; index < fUsed; ++index) {
double val = fT[fSwap][index];
@@ -52,7 +68,9 @@
}
double fT[2][9];
+ double fCoincidentT[2][9];
int fUsed;
+ int fCoincidentUsed;
private:
int fSwap;
};