View Single Post
  #6 (permalink)  
Old July 6th, 2005, 08:18 PM
rharris rharris is offline
Registered User
Join Date: Jun 2005
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts

Yes, the example I gave would be to fill the space between a sine wave and the x-axis, but it will work for any region. The user clicks inside a closed region, whereby the coordinates of the click are sent to a recusive routine. Basically the routine tests the pixel color of the point given, and colors it blue if it is grey. It then tells the neighboring pixels (above and below that pixel) to color themselves blue if they are grey. The coloring is carried out until the blue boundary curves(i.e. f(x)=sin(x),f(x)=0,etc) are reached. So, each call to the function can result in 4 additional function calls to itself (if all neighboring pixels need coloring). For smaller regions this is no problem, but for larger regions the code bombs with a stack overflow exception.


Reply With Quote