aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/Intersection/QuarticRoot.cpp
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-22 21:50:07 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-02-22 21:50:07 +0000
commitc83c70e911a38aea03db4af8dd9841d0d77bd129 (patch)
treec957cfecc8e073f178dc13aae8a16d9bd3653e8c /experimental/Intersection/QuarticRoot.cpp
parentf8d7d2731318cdf510ab68e6b3f5ec68ab22c8e2 (diff)
shape ops work in progress
git-svn-id: http://skia.googlecode.com/svn/trunk@7836 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/QuarticRoot.cpp')
-rw-r--r--experimental/Intersection/QuarticRoot.cpp35
1 files changed, 33 insertions, 2 deletions
diff --git a/experimental/Intersection/QuarticRoot.cpp b/experimental/Intersection/QuarticRoot.cpp
index ea786e4407..061098a598 100644
--- a/experimental/Intersection/QuarticRoot.cpp
+++ b/experimental/Intersection/QuarticRoot.cpp
@@ -45,6 +45,37 @@ int reducedQuarticRoots(const double t4, const double t3, const double t2, const
SkDebugf("%s\n", str);
#endif
#endif
+#if 0 && SK_DEBUG
+ bool t4Or = approximately_zero_when_compared_to(t4, t0) // 0 is one root
+ || approximately_zero_when_compared_to(t4, t1)
+ || approximately_zero_when_compared_to(t4, t2);
+ bool t4And = approximately_zero_when_compared_to(t4, t0) // 0 is one root
+ && approximately_zero_when_compared_to(t4, t1)
+ && approximately_zero_when_compared_to(t4, t2);
+ if (t4Or != t4And) {
+ SkDebugf("%s t4 or and\n", __FUNCTION__);
+ }
+ bool t3Or = approximately_zero_when_compared_to(t3, t0)
+ || approximately_zero_when_compared_to(t3, t1)
+ || approximately_zero_when_compared_to(t3, t2);
+ bool t3And = approximately_zero_when_compared_to(t3, t0)
+ && approximately_zero_when_compared_to(t3, t1)
+ && approximately_zero_when_compared_to(t3, t2);
+ if (t3Or != t3And) {
+ SkDebugf("%s t3 or and\n", __FUNCTION__);
+ }
+ bool t0Or = approximately_zero_when_compared_to(t0, t1) // 0 is one root
+ && approximately_zero_when_compared_to(t0, t2)
+ && approximately_zero_when_compared_to(t0, t3)
+ && approximately_zero_when_compared_to(t0, t4);
+ bool t0And = approximately_zero_when_compared_to(t0, t1) // 0 is one root
+ && approximately_zero_when_compared_to(t0, t2)
+ && approximately_zero_when_compared_to(t0, t3)
+ && approximately_zero_when_compared_to(t0, t4);
+ if (t0Or != t0And) {
+ SkDebugf("%s t0 or and\n", __FUNCTION__);
+ }
+#endif
if (approximately_zero_when_compared_to(t4, t0) // 0 is one root
&& approximately_zero_when_compared_to(t4, t1)
&& approximately_zero_when_compared_to(t4, t2)) {
@@ -57,8 +88,8 @@ int reducedQuarticRoots(const double t4, const double t3, const double t2, const
return cubicRootsReal(t3, t2, t1, t0, roots);
}
}
- if (approximately_zero_when_compared_to(t0, t1) // 0 is one root
- && approximately_zero_when_compared_to(t0, t2)
+ if ((approximately_zero_when_compared_to(t0, t1) || approximately_zero(t1))// 0 is one root
+ // && approximately_zero_when_compared_to(t0, t2)
&& approximately_zero_when_compared_to(t0, t3)
&& approximately_zero_when_compared_to(t0, t4)) {
int num = cubicRootsReal(t4, t3, t2, t1, roots);