caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 1 | #include "DataTypes.h" |
| 2 | |
| 3 | class Intersections; |
| 4 | |
| 5 | // unit-testable utilities |
| 6 | bool bezier_clip(const Cubic& cubic1, const Cubic& cubic2, double& minT, double& maxT); |
| 7 | bool bezier_clip(const Quadratic& q1, const Quadratic& q2, double& minT, double& maxT); |
| 8 | void chop_at(const Cubic& src, CubicPair& dst, double t); |
| 9 | void chop_at(const Quadratic& src, QuadraticPair& dst, double t); |
| 10 | int convex_hull(const Cubic& cubic, char order[4]); |
| 11 | bool convex_x_hull(const Cubic& cubic, char connectTo0[2], char connectTo3[2]); |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 12 | bool implicit_matches(const Cubic& cubic1, const Cubic& cubic2); |
| 13 | bool implicit_matches(const Quadratic& quad1, const Quadratic& quad2); |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 14 | void sub_divide(const Cubic& src, double t1, double t2, Cubic& dst); |
| 15 | void sub_divide(const Quadratic& src, double t1, double t2, Quadratic& dst); |
| 16 | void tangent(const Cubic& cubic, double t, _Point& result); |
| 17 | void tangent(const Quadratic& cubic, double t, _Point& result); |
| 18 | |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame^] | 19 | // utilities used only for unit testing |
| 20 | bool point_on_parameterized_curve(const Cubic& cubic, const _Point& point); |
| 21 | bool point_on_parameterized_curve(const Quadratic& quad, const _Point& point); |
| 22 | |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 23 | // main functions |
| 24 | enum ReduceOrder_Flags { |
| 25 | kReduceOrder_NoQuadraticsAllowed, |
| 26 | kReduceOrder_QuadraticsAllowed |
| 27 | }; |
| 28 | int reduceOrder(const Cubic& cubic, Cubic& reduction, ReduceOrder_Flags ); |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame^] | 29 | int reduceOrder(const _Line& line, _Line& reduction); |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 30 | int reduceOrder(const Quadratic& quad, Quadratic& reduction); |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame^] | 31 | //bool intersectStart(const Cubic& cubic1, const Cubic& cubic2, Intersections& ); |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 32 | bool intersectStartT(const Cubic& cubic1, const Cubic& cubic2, Intersections& ); |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame^] | 33 | bool intersectStart(const Cubic& cubic, const _Line& line, Intersections& ); |
caryclark@google.com | 639df89 | 2012-01-10 21:46:10 +0000 | [diff] [blame] | 34 | bool intersectStart(const Quadratic& q1, const Quadratic& q2, Intersections& ); |
caryclark@google.com | 27accef | 2012-01-25 18:57:23 +0000 | [diff] [blame^] | 35 | bool intersectStart(const Quadratic& quad, const _Line& line, Intersections& ); |