-static int approximate2(struct cspline*s, struct qspline*q, double quality, double start, double end, int max, int depth)
-{
- int num=0;
- struct SPLINEPOINT qr1,qr2,cr1,cr2;
- double dist1,dist2;
- double qquality = quality*quality;
- int t;
- int recurse = 0;
- int probes = 15;
- struct qspline test;
- char left = 0;
- test.start = cspline_getpoint(s, start);
- test.control = cspline_getpoint(s, (start+end)/2);
- test.end = cspline_getpoint(s, end);
- fixcp(&test);
-
- if(start< 0.5) {
- test.control = cspline_getderivative(s, start);
- test.control.x *= (end-start)/2;
- test.control.y *= (end-start)/2;
- test.control.x += test.start.x;
- test.control.y += test.start.y;
- } else {
- test.control = cspline_getderivative(s, end);
- test.control.x *= -(end-start)/2;
- test.control.y *= -(end-start)/2;
- test.control.x += test.end.x;
- test.control.y += test.end.y;
- }
+ /* create simple approximation: a qspline which run's through the
+ qspline point at 0.5 */
+ test.start = cspline_getpoint(s, start);
+ test.control = cspline_getpoint(s, (start+end)/2);
+ test.end = cspline_getpoint(s, end);
+ /* fix the control point:
+ move it so that the new spline does runs through it */
+ test.control.x = -(test.end.x + test.start.x)/2 + 2*(test.control.x);
+ test.control.y = -(test.end.y + test.start.y)/2 + 2*(test.control.y);