8642420@wwu.edu (eric cosky) (04/27/89)
Here's a fast way to plot lines- Have an array of your lines: struct Line { int sx,sy,ex,ey }; struct Line array[MAXLINES] (MAXLINES could be defined or a function argument) then select a random line (the first one works well), plot it, then iff it's not the first object in the array, swap it so that the line just drawn is the first object and the ex-first-object is now in that position. Then, travel down the array starting at n; n being how many lines you have drawn minus 1. Keep track of the object whose sx & sy values are closest to the ex & ey values of array[0], and plot that one next. Then put that line into the first array position, increase n, and keep going. I forget exactly how fast this is, but I think I remember it said that this has been proven to be within 20% of an ideal plot sequence. (nearest neighbor algorithm). -eric cosky InterNet: 8642420@wwu.edu ATT: 206-733-1331