void arc(double x, double y, double x0, double y0, double x1, double y1) /* draw arc with center x,y */ { move(x0, y0); hvflush(); printf("\\D'a%.3fi %.3fi %.3fi %.3fi'\n", xsc(x-x0), -ysc(y-y0), xsc(x1-x), -ysc(y1-y)); /* WATCH SIGNS */ flyback(); }
point(xi,yi){ struct {char pad,c; int x,y;} p; p.c = 2; p.x = xnow = xsc(xi); p.y = ynow = ysc(yi); write(vti,&p.c,5); }
void point(int xi, int yi) { if(xsc(xi)!=currentx || ysc(yi)!=currenty) move(xi,yi); printf("V[]"); }
void point(int xi, int yi) { if(xsc(xi)!=currentx || ysc(yi)!=currenty) move(xi,yi); buffready(1); putchar('d'); }
void ellipse(double x, double y, double r1, double r2) { double ir1, ir2; move(x-r1, y); hvflush(); ir1 = xsc(r1); ir2 = ysc(r2); printf("\\D'e%.3fi %.3fi'\n", 2 * ir1, 2 * fabs(ir2)); flyback(); }
void spline(double x, double y, double n, ofloat *p, int dashed __unused, double ddval __unused) { int i; double dx, dy; double xerr, yerr; move(x, y); hvflush(); xerr = yerr = 0.0; printf("\\D'~"); for (i = 0; i < 2 * n; i += 2) { dx = xsc(xerr += p[i]); xerr -= dx/xscale; dy = ysc(yerr += p[i+1]); yerr -= dy/yscale; printf(" %.3fi %.3fi", dx, -dy); /* WATCH SIGN */ } printf("'\n"); flyback(); }
move(xi,yi){ movep(xconv(xsc(xi)),yconv(ysc(yi))); return; }
void cont(int x0, int y0) { iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0))); return; }
void line(int x0, int y0, int x1, int y1) { iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1))); return; }
cont(x0,y0){ iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0))); return; }
line(x0,y0,x1,y1){ iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1))); return; }