Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
fill point maximum
#21
Heckbert fill proceeds scanline by scanline. Don't know how it fits into your classification. I once posted it for Jark at this forum,
http://forum.qbasicnews.com/viewtopic.ph...t=heckbert
In a stack the last item you push is the first you retrieve. A stack is Last In-First out (LIFO). In a queue the first item pushed is the first you Retrieve (FIFO).

I can also post a very simple RECURSIVE Hilbert curve algorithm. I remember you hating recursion.... :evil: Big Grin
Edited:
Code:
'Hilbert curve
DECLARE SUB Hilbert (r1%, r2%, level%)
SCREEN 12
PSET (0, 0)
clr% = 12
Hilbert 2, 0, 8
a$ = INPUT$(1)
END

SUB Hilbert (r1%, r2%, level%)
SHARED clr%
IF level% THEN
  Hilbert r2%, r1%, level% - 1
  LINE -STEP(r1%, r2%), clr%
  Hilbert r1%, r2%, level% - 1
  LINE -STEP(r2%, r1%), clr%
  Hilbert r1%, r2%, level% - 1
  LINE -STEP(-r1%, -r2%), clr%
  Hilbert -r2%, -r1%, level% - 1
END IF
END SUB
Antoni
Reply
#22
Heckbert fill...
line by line...
Hmm..
Didn't look at the code closely..... but.. it grows by lines, scanning the edges of each line, potentially reducing the size of the array needed? Hmmm...

Neat... Can't test it now though or my computer will freeze......

My algorithm is a FIFO queue anyways actually.. Size of array can't be made smaller with a slower algorithm, can it? (er, except scanning the 2D array each time)

I think I'll try to make that an iterative algorithm.....
Peace cannot be obtained without war. Why? If there is already peace, it is unnecessary for war. If there is no peace, there is already war."

Visit www.neobasic.net to see rubbish in all its finest.
Reply
#23
I once thought about reducing the stack size by checking it for redundant entries. The same point-direction-line or whatever the stack stores can be generated twice by explorating the plan from dfferent points. Also a point being filled can invalidate some existant stack entries.

All that would be very slow (and difficult to implement) but this way the stack could be kept to a minimum.
Antoni
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)