#ifndef lint
static char *sccsid = "@(#)outputline.c	1.1 (UKC) 9/12/87";
#endif  lint
#include "types.h"

/* output plane is 0..4095 (for digs) */
#define OFFSET	(4096/2)
#define SCALE	(4096/2 - 1)

/* x and y are in the range -1.0 .. +1.0 */
outputline(xP, yP, xQ, yQ)
double xP, yP, xQ, yQ;
{
	/* where is the pen (for output optimisation) */
	static int curx = 0, cury = 0;
	int x1, y1, x2, y2;	/* values translated to device coords */
		
	x1 = OFFSET + (int) (SCALE * xP);
	y1 = OFFSET + (int) (SCALE * yP);
	x2 = OFFSET + (int) (SCALE * xQ);
	y2 = OFFSET + (int) (SCALE * yQ);
	
	if (curx == x1 && cury == y1) {
		cont(x2, y2);
		curx = x2; cury = y2;
	} else if (curx == x2 && cury == y2) {
		cont(x1, y1);
		curx = x1; cury = y1;
	} else {
		line(x1, y1, x2, y2);
		curx = x2; cury = y2;
	}
}
