Qbasicnews.com
fill point maximum - Printable Version

+- Qbasicnews.com (http://qbasicnews.com/newforum)
+-- Forum: QbasicNews.Com (http://qbasicnews.com/newforum/forum-3.html)
+--- Forum: Challenges (http://qbasicnews.com/newforum/forum-10.html)
+--- Thread: fill point maximum (/thread-3230.html)

Pages: 1 2 3


fill point maximum - Antoni Gual - 02-24-2004

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.php?t=3441&highlight=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



fill point maximum - Agamemnus - 02-25-2004

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.....


fill point maximum - Antoni Gual - 02-25-2004

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.