[GRASS5] [bug #242] (grass) R_polygon_abs() seems to ignoreislands

Justin Hickey jhickey at hpcc.nectec.or.th
Wed May 2 23:39:37 EDT 2001


Hi Eric and Glynn

Glynn Clements wrote:
> 
> Eric G. Miller wrote:
> > We're only talking the context of filling
> > an area defined by a polygon, but allowing a portion of the filled 
> > area to be masked (so it retains whatever was already there). 
> > Like:
> >
> >   ------
> >   \xxxxx\___________
> >    |xxxxxxxxxxxxxxxx|
> >    \x-------xxxxxxx/
> >     \x\     \xxxxx/
> >      \x\_____\xxx/
> >       \xxxxxxxxx/
> >        ---------
> 
> OK; a lot of people (myself included) wouldn't call that a "polygon".
> Further, a lot of people automatically read "polygon" as "convex
> polygon", as many graphics APIs are limited to such.
> 
> A correct solution is far from straightforward, as the Mesa[1] folks
> have discovered.

I find this strange since there exists a well known graphics polygon
filling algorithm that can handle polygons which are concave, convex,
self-intersecting, and polygons with holes. Eric and I briefly discussed
this in a previous thread. I will include part of it (two sections) for
Glynn's benefit.

Justin Hickey wrote
> > I'm sorry I didn't read my mail this weekend, but the most 
> > efficinet way to solve your problem is to use a computer graphics
> > algorithm for filling polygons. This algorithm handles convex
> > polygons, concave polygons, self-intersecting polygons, and
> > polygons with holes (or islands in your case). Since you already
> > did a lot of coding, you may not be interested in this algorithm.
> > However, if you are interested, it can be found in the book
> > "Computer Graphics: Principles and Practice" by Foley, Van Dam,
> > Feiner, and Hughes (see section 3.6 "Filling Polygons"). If you
> > cannot find this book, let me know and I'll see what I can do to
> > summarize the algorithm for you. Note that with this algorithm, you
> > do not have to worry about which areas are islands. However, you
> > may need to modify this if you have nested islands.

Eric Miller wrote
> Such changes would have to be made at the driver lib side, as Radim
> noted.  I don't know if I'm up to adding in another protocol call
> to the rasterlib and the various driver libs.  It'd probably be the
> "correct" way to handle these islands, but there are many places
> where changes would have to be made (as opposed to one place in the
> calling module).

So, as Eric said, this algorithm may mean a lot of work to implement but
I agree with him that it is the correct solution.

-- 
Sincerely,

Jazzman (a.k.a. Justin Hickey)  e-mail: jhickey at hpcc.nectec.or.th
High Performance Computing Center
National Electronics and Computer Technology Center (NECTEC)
Bangkok, Thailand
==================================================================
People who think they know everything are very irritating to those
of us who do.  ---Anonymous

Jazz and Trek Rule!!!
==================================================================

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list