aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/Intersection/QuadraticParameterization_TestUtility.cpp
diff options
context:
space:
mode:
authorGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-25 18:57:23 +0000
committerGravatar caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-01-25 18:57:23 +0000
commit27accef223a27fba437f5e825d99edbae20a045b (patch)
treebba808edd5117406ec3d17f08baebdbbd4338a1a /experimental/Intersection/QuadraticParameterization_TestUtility.cpp
parent76bd2540b55f31c8e72adb2fa72a88d7f4ba5374 (diff)
Intersection work in progress
Review URL: https://codereview.appspot.com/5576043 git-svn-id: http://skia.googlecode.com/svn/trunk@3087 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental/Intersection/QuadraticParameterization_TestUtility.cpp')
-rw-r--r--experimental/Intersection/QuadraticParameterization_TestUtility.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/experimental/Intersection/QuadraticParameterization_TestUtility.cpp b/experimental/Intersection/QuadraticParameterization_TestUtility.cpp
new file mode 100644
index 0000000000..326b28e4df
--- /dev/null
+++ b/experimental/Intersection/QuadraticParameterization_TestUtility.cpp
@@ -0,0 +1,15 @@
+// included by QuadraticParameterization.cpp
+// accesses internal functions to validate parameterized coefficients
+
+bool point_on_parameterized_curve(const Quadratic& quad, const _Point& point) {
+ double coeffs[coeff_count];
+ implicit_coefficients(quad, coeffs);
+ double xx = coeffs[ xx_coeff] * point.x * point.x;
+ double xy = coeffs[ xy_coeff] * point.x * point.y;
+ double yy = coeffs[ yy_coeff] * point.y * point.y;
+ double x = coeffs[ x_coeff] * point.x;
+ double y = coeffs[ y_coeff] * point.y;
+ double c = coeffs[ c_coeff];
+ double sum = xx + xy + yy + x + y + c;
+ return approximately_zero(sum);
+}