Omnimaga

Calculator Community => TI Calculators => Axe => Topic started by: Michael_Lee on October 12, 2010, 01:48:31 pm

Title: Drawing lines
Post by: Michael_Lee on October 12, 2010, 01:48:31 pm
Hi - quickly, could somebody explain how Axe draws lines (as in, how it chooses which pixels to turn on)?

Is there a formula of some kind, and how would the routine-thingy handle turning on multiple dots in the same column or row?
Title: Re: Drawing lines
Post by: kindermoumoute on October 12, 2010, 01:55:17 pm
Quote
Line(X1,Y1,X2,Y2) Draws a black line from point (X1,Y1) to (X2,Y2) on the buffer.

pixel start Top left to X=0 and Y=0, and finish bottom right to X=96 and Y=64.

Next you need dispgraph.
Title: Re: Drawing lines
Post by: Michael_Lee on October 12, 2010, 01:56:31 pm
Ah - not what I meant.  Sorry.
I know about the line command, but I would like to know at a more indepth scale exactly which pixels the command knows to turn on.

(What I will end up trying to do is check along a line to see when it encounters a pixel already on, then draw the line only to that point.)
Title: Re: Drawing lines
Post by: AngelFish on October 12, 2010, 02:05:03 pm
This doesn't answer the question, but what you could do is simply do a pxl-test( loop where you constantly change the position of the pixel. When the test returns a one, store the answer to a variable. Then all you have to do is draw the line to that point.
Title: Re: Drawing lines
Post by: Quigibo on October 12, 2010, 03:19:28 pm
I used this:

http://en.wikipedia.org/wiki/Bresenham%27s_line_algorithm
Title: Re: Drawing lines
Post by: Deep Toaster on October 13, 2010, 12:03:35 pm
Doesn't it use an OS b_call? If not, informal feature request: Line()r.