17f70b353Sbostic /*-
2*8dddb436Sbostic * Copyright (c) 1983, 1993
3*8dddb436Sbostic * The Regents of the University of California. All rights reserved.
47f70b353Sbostic *
57f70b353Sbostic * %sccs.include.proprietary.c%
67f70b353Sbostic */
77f70b353Sbostic
868745a78Ssam #ifndef lint
9*8dddb436Sbostic static char sccsid[] = "@(#)line.c 8.1 (Berkeley) 06/04/93";
107f70b353Sbostic #endif /* not lint */
1168745a78Ssam
1268745a78Ssam #include "con.h"
line(x0,y0,x1,y1)1368745a78Ssam line(x0,y0,x1,y1){
1468745a78Ssam iline(xconv(xsc(x0)),yconv(ysc(y0)),xconv(xsc(x1)),yconv(ysc(y1)));
1568745a78Ssam return;
1668745a78Ssam }
cont(x0,y0)1768745a78Ssam cont(x0,y0){
1868745a78Ssam iline(xnow,ynow,xconv(xsc(x0)),yconv(ysc(y0)));
1968745a78Ssam return;
2068745a78Ssam }
iline(cx0,cy0,cx1,cy1)2168745a78Ssam iline(cx0,cy0,cx1,cy1){
2268745a78Ssam int maxp,tt,j,np;
2368745a78Ssam char chx,chy,command;
2468745a78Ssam float xd,yd;
259e722afeStorek double dist2(),sqrt();
2668745a78Ssam movep(cx0,cy0);
2768745a78Ssam maxp = sqrt(dist2(cx0,cy0,cx1,cy1))/2.;
2868745a78Ssam xd = cx1-cx0;
2968745a78Ssam yd = cy1-cy0;
3068745a78Ssam command = COM|((xd<0)<<1)|(yd<0);
3168745a78Ssam if(maxp == 0){
3268745a78Ssam xd=0;
3368745a78Ssam yd=0;
3468745a78Ssam }
3568745a78Ssam else {
3668745a78Ssam xd /= maxp;
3768745a78Ssam yd /= maxp;
3868745a78Ssam }
3968745a78Ssam inplot();
4068745a78Ssam spew(command);
4168745a78Ssam for (tt=0; tt<=maxp; tt++){
4268745a78Ssam chx= cx0+xd*tt-xnow;
4368745a78Ssam xnow += chx;
4468745a78Ssam chx = abval(chx);
4568745a78Ssam chy = cy0+yd*tt-ynow;
4668745a78Ssam ynow += chy;
4768745a78Ssam chy = abval(chy);
4868745a78Ssam spew(ADDR|chx<<3|chy);
4968745a78Ssam }
5068745a78Ssam outplot();
5168745a78Ssam return;
5268745a78Ssam }
53