shape ops work in progress
mostly working on cubic/cubic intersect
git-svn-id: http://skia.googlecode.com/svn/trunk@7266 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/experimental/Intersection/CubicReduceOrder.cpp b/experimental/Intersection/CubicReduceOrder.cpp
index d1775d8..fdc7265 100644
--- a/experimental/Intersection/CubicReduceOrder.cpp
+++ b/experimental/Intersection/CubicReduceOrder.cpp
@@ -149,22 +149,17 @@
bool isLinear(const Cubic& cubic, int startIndex, int endIndex) {
LineParameters lineParameters;
lineParameters.cubicEndPoints(cubic, startIndex, endIndex);
- double normalSquared = lineParameters.normalSquared();
- double distance[2]; // distance is not normalized
+ // FIXME: maybe it's possible to avoid this and compare non-normalized
+ lineParameters.normalize();
int mask = other_two(startIndex, endIndex);
int inner1 = startIndex ^ mask;
int inner2 = endIndex ^ mask;
- lineParameters.controlPtDistance(cubic, inner1, inner2, distance);
- double limit = normalSquared;
- int index;
- for (index = 0; index < 2; ++index) {
- double distSq = distance[index];
- distSq *= distSq;
- if (approximately_greater(distSq, limit)) {
- return false;
- }
+ double distance = lineParameters.controlPtDistance(cubic, inner1);
+ if (!approximately_zero(distance)) {
+ return false;
}
- return true;
+ distance = lineParameters.controlPtDistance(cubic, inner2);
+ return approximately_zero(distance);
}
/* food for thought: