[GRASSLIST:5694] Re: Filling a polygon using a "bucket with color"

    I have an area described by several lines and I need to find a
function which is similar to "spilling a color". From a given point I need
to set all surrounding points to have some speicifed value/category until
reaches wall(borders) from lines.

    The border is defined by non-zero values, other values are zero (of
course I can change it if needed). Any idea?

    This method is used in almost all graphical programs, but I need to
use some GRASS method because of non-interactivity.

               Thanks for help

Time ago I was asking pretty much the same thing (see yourslf). Well a guy replied me but I do not rememer what was the resolution to the problem. I remember you had to do some kind of editing in the category files. Try to find the answer in the mailing list archive.

Miha Staut

http://op.gfz-potsdam.de/GRASS-List/Archive/msg08130.html

_________________________________________________________________
The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail

> I have an area described by several lines and I need to find a
>function which is similar to "spilling a color". From a given point I
>need to set all surrounding points to have some speicifed
>value/category until reaches wall(borders) from lines.
>
> The border is defined by non-zero values, other values are zero
> (of course I can change it if needed). Any idea?

You can find an algorithm for "Determining Whether A Point Is Inside A
Complex Polygon" here:
http://www.alienryderflex.com/polygon/

Aside from the explanation, that page includes a working C code snippet.

A custom module might be easier to implement rather than trying to get
that into r.mapcalc though.

If you are just defining the border from a set of points, make an ascii
poly file with r.in.poly; or vector file with v.in.ascii and then
manipulate with v.digit to set area centroids, and then v.to.rast ?

maybe r.thin, r.line, v.digit, and then v.to.rast ?

best of luck.