Author Topic: Drawing lines  (Read 2559 times)

0 Members and 1 Guest are viewing this topic.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Drawing lines
« 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?
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline kindermoumoute

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 836
  • Rating: +54/-3
    • View Profile
Re: Drawing lines
« Reply #1 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.
« Last Edit: October 12, 2010, 01:55:51 pm by kindermoumoute »
Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Drawing lines
« Reply #2 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.)
« Last Edit: October 12, 2010, 01:57:57 pm by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: Drawing lines
« Reply #3 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.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Drawing lines
« Reply #4 on: October 12, 2010, 03:19:28 pm »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline Deep Toaster

  • So much to do, so much time, so little motivation
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 8217
  • Rating: +758/-15
    • View Profile
    • ClrHome
Re: Drawing lines
« Reply #5 on: October 13, 2010, 12:03:35 pm »
Doesn't it use an OS b_call? If not, informal feature request: Line()r.