blob: e5d74c0a2b2b7bf9f6ae7c6100b99e46ed29bae6 [file] [log] [blame]
caryclark@google.com639df892012-01-10 21:46:10 +00001#include "DataTypes.h"
2
3class Intersections;
4
5// unit-testable utilities
6bool bezier_clip(const Cubic& cubic1, const Cubic& cubic2, double& minT, double& maxT);
7bool bezier_clip(const Quadratic& q1, const Quadratic& q2, double& minT, double& maxT);
8void chop_at(const Cubic& src, CubicPair& dst, double t);
9void chop_at(const Quadratic& src, QuadraticPair& dst, double t);
10int convex_hull(const Cubic& cubic, char order[4]);
11bool convex_x_hull(const Cubic& cubic, char connectTo0[2], char connectTo3[2]);
caryclark@google.com639df892012-01-10 21:46:10 +000012bool implicit_matches(const Cubic& cubic1, const Cubic& cubic2);
13bool implicit_matches(const Quadratic& quad1, const Quadratic& quad2);
caryclark@google.com639df892012-01-10 21:46:10 +000014void sub_divide(const Cubic& src, double t1, double t2, Cubic& dst);
15void sub_divide(const Quadratic& src, double t1, double t2, Quadratic& dst);
16void tangent(const Cubic& cubic, double t, _Point& result);
17void tangent(const Quadratic& cubic, double t, _Point& result);
18
caryclark@google.com27accef2012-01-25 18:57:23 +000019// utilities used only for unit testing
20bool point_on_parameterized_curve(const Cubic& cubic, const _Point& point);
21bool point_on_parameterized_curve(const Quadratic& quad, const _Point& point);
22
caryclark@google.com639df892012-01-10 21:46:10 +000023// main functions
24enum ReduceOrder_Flags {
25 kReduceOrder_NoQuadraticsAllowed,
26 kReduceOrder_QuadraticsAllowed
27};
28int reduceOrder(const Cubic& cubic, Cubic& reduction, ReduceOrder_Flags );
caryclark@google.com27accef2012-01-25 18:57:23 +000029int reduceOrder(const _Line& line, _Line& reduction);
caryclark@google.com639df892012-01-10 21:46:10 +000030int reduceOrder(const Quadratic& quad, Quadratic& reduction);
caryclark@google.com27accef2012-01-25 18:57:23 +000031//bool intersectStart(const Cubic& cubic1, const Cubic& cubic2, Intersections& );
caryclark@google.com639df892012-01-10 21:46:10 +000032bool intersectStartT(const Cubic& cubic1, const Cubic& cubic2, Intersections& );
caryclark@google.com27accef2012-01-25 18:57:23 +000033bool intersectStart(const Cubic& cubic, const _Line& line, Intersections& );
caryclark@google.com639df892012-01-10 21:46:10 +000034bool intersectStart(const Quadratic& q1, const Quadratic& q2, Intersections& );
caryclark@google.com27accef2012-01-25 18:57:23 +000035bool intersectStart(const Quadratic& quad, const _Line& line, Intersections& );