Alternate way to draw a line (PSET line) - Printable Version +- Qbasicnews.com (http://qbasicnews.com/newforum) +-- Forum: Qbasic "like" compilers/interpreters (http://qbasicnews.com/newforum/forum-5.html) +--- Forum: FB Discussion & Programming Help (http://qbasicnews.com/newforum/forum-15.html) +--- Thread: Alternate way to draw a line (PSET line) (/thread-8583.html) |
Alternate way to draw a line (PSET line) - axipher - 12-19-2005 My program requires a way to draw a line, but by PSET because I need limits without changing the x and y start and end coordinates. Also, if the pset is isolated, I can just add 3 other ones to create the 2x zoomed version, unless you want to include that, but I want to figure something out. Alternate way to draw a line (PSET line) - marzecTM - 12-19-2005 google for bresenham, or if you want an easier variant DDA Alternate way to draw a line (PSET line) - KiZ - 12-19-2005 I made this a loooong time ago. Ive modifed it to include a length param. Im not sure exactly how you need the limits defined, however, This uses 0-100 percent of the line. Also, I havent tested this with the alteration, although Im sure it will work. er, second thoughts it would crash if the x1,y1 and x2,y2 coords were identical. Guess I did make this a long time ago :d Code: 'DarkLine Alternate way to draw a line (PSET line) - axipher - 12-19-2005 Well I used the Bresenham Algorythm and modified it to this: Code: SUB BLine (x%, y%, x2%, y2%, c%) Now it works perfectly and I am glad to say that, my program is pretty much completed and maybe now I'll just add a few more commands like drawing a box filled or unfilled. |