caryclark@google.com | f47c217 | 2012-03-27 13:45:24 +0000 | [diff] [blame^] | 1 | // included by QuadraticParameterization.cpp |
| 2 | // accesses internal functions to validate parameterized coefficients |
| 3 | |
| 4 | #include "Parameterization_Test.h" |
| 5 | |
| 6 | bool point_on_parameterized_curve(const Quadratic& quad, const _Point& point) { |
| 7 | double coeffs[coeff_count]; |
| 8 | implicit_coefficients(quad, coeffs); |
| 9 | double xx = coeffs[ xx_coeff] * point.x * point.x; |
| 10 | double xy = coeffs[ xy_coeff] * point.x * point.y; |
| 11 | double yy = coeffs[ yy_coeff] * point.y * point.y; |
| 12 | double x = coeffs[ x_coeff] * point.x; |
| 13 | double y = coeffs[ y_coeff] * point.y; |
| 14 | double c = coeffs[ c_coeff]; |
| 15 | double sum = xx + xy + yy + x + y + c; |
| 16 | return approximately_zero(sum); |
| 17 | } |