|
|
1.1 ! root 1: #include <math.h> ! 2: #include <stdio.h> ! 3: #include "tek.h" ! 4: parabola(x0, y0, x1, y1, xb, yb) ! 5: double x0, y0, x1, y1, xb, yb; ! 6: { ! 7: register double x, y, t; ! 8: double c0x, c0y, c1x, c1y; ! 9: double dt, d2, d1; ! 10: d1 = sqrt((xb - x0) * (xb - x0) + (yb - y0) * (yb - y0)); ! 11: d2 = sqrt((xb - x1) * (xb - x1) + (yb - y1) * (yb - y1)); ! 12: if (d1 <= e1->quantum || d2 <= e1->quantum) { ! 13: line(x0, y0, x1, y1); ! 14: return(0); ! 15: } ! 16: c0x = x0 + x1 - 2. * xb; ! 17: c1x = 2. * (xb - x0); ! 18: c0y = y0 + y1 - 2. * yb; ! 19: c1y = 2. * (yb - y0); ! 20: move(x0, y0); ! 21: dt = e1->quantum / d1; ! 22: if(e1->grade != 0.) ! 23: dt /= e1->grade; ! 24: for (t = dt; t < 0.5; t += dt) { ! 25: x = (c0x * t + c1x) * t + x0; ! 26: y = (c0y * t + c1y) * t + y0; ! 27: vec(x, y); ! 28: } ! 29: dt = e1->quantum / d2; ! 30: if(e1->grade != 0.) ! 31: dt /= e1->grade; ! 32: for (; t < 1.0; t += dt) { ! 33: x = (c0x * t + c1x) * t + x0; ! 34: y = (c0y * t + c1y) * t + y0; ! 35: vec(x, y); ! 36: } ! 37: vec(x1, y1); ! 38: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.