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

this bug's URL: http://intevation.de/rt/webrt?serial_num=242
-------------------------------------------------------------------------

Subject: R_polygon_abs() seems to ignore islands

- Vector:
  R_polygon_abs() seems to ignore islands. Correct?

  Comment from Eric Miller:
   While skimming through the BUG list, there's a report about
   R_Polygon_abs() ignoring islands. A little investigation would show this
   to be correct. However, each display driver must implement this
   individually, and I only looked at the XDRIVER24 version.
   Anyway, the code is real simple and does not do anything other than draw
   a filled polygon based on supplied display coordinates and the already
   set fill color. Presumably it is up to the caller to handle
   islands/holes. However, this is probably not a simple task when drawing a
   filled polygon cover over other layers. Perhaps what is wanted is a high
   level vector drawing command such as some of the commands in the
   partially functional DISPLAYLIB??? I don't know X well enough to know if
   it has a way to handle holes in it's polygon drawing routines.
   A little more context for the BUG report seems in order since this really
   doesn't seem to be a "bug", but a shortcoming.

-------------------------------------------- Managed by Request Tracker

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

Request Tracker wrote:

Subject: R_polygon_abs() seems to ignore islands

- Vector:
  R_polygon_abs() seems to ignore islands. Correct?

  Comment from Eric Miller:
   While skimming through the BUG list, there's a report about
   R_Polygon_abs() ignoring islands. A little investigation would show this
   to be correct. However, each display driver must implement this
   individually, and I only looked at the XDRIVER24 version.

XDRIVER24 uses XFillPolygon's "Complex" mode, which should handle
self-intersecting polygons. However, there is a choice of two filling
rules: EvenOdd and WindingRule. From the XChangeGC manpage:

       The fill-rule defines what pixels are inside (drawn) for
       paths given in XFillPolygon requests and can be set to
       EvenOddRule or WindingRule. For EvenOddRule, a point is
       inside if an infinite ray with the point as origin crosses
       the path an odd number of times. For WindingRule, a point
       is inside if an infinite ray with the point as origin
       crosses an unequal number of clockwise and counterclock­
       wise directed path segments. A clockwise directed path
       segment is one that crosses the ray from left to right as
       observed from the point. A counterclockwise segment is
       one that crosses the ray from right to left as observed
       from the point. The case where a directed line segment is
       coincident with the ray is uninteresting because you can
       simply choose a different ray that is not coincident with
       a segment.

The CELL driver only supports convex polygons.

The PNG driver uses gdImageFilledPolygon(); I don't know what that
supports.

The HTMLMAP driver cleans up the polygons, removes any polygon which
is completely enclosed by another polygon (treating polygons as
convex), then writes out the results as HTML <AREA ...> tags. The
interpretation will be whatever HTML defines it to be.

In short, if you want anything but convex polygons to work generally,
we're going to need a polygon tessellator. IIRC, Mesa implements the
GLU 1.2 tessellator, so we could lift that.

   Anyway, the code is real simple and does not do anything other than draw
   a filled polygon based on supplied display coordinates and the already
   set fill color. Presumably it is up to the caller to handle
   islands/holes. However, this is probably not a simple task when drawing a
   filled polygon cover over other layers. Perhaps what is wanted is a high
   level vector drawing command such as some of the commands in the
   partially functional DISPLAYLIB??? I don't know X well enough to know if
   it has a way to handle holes in it's polygon drawing routines.
   A little more context for the BUG report seems in order since this really
   doesn't seem to be a "bug", but a shortcoming.

All that progmangrass50.pdf says is:

    int
    R_polygon_abs (int *x, int *y,int num)

    The num absolute positions in the x and y arrays outline a closed
    polygon which is filled with the current color. The current position
    is left updated to the position of the last point.

So, it basically comes down to what it means by "polygon".

Is there any context (within GRASS) where "polygon" has a more precise
definition?

--
Glynn Clements <glynn.clements@virgin.net>

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

On Wed, May 02, 2001 at 01:23:53PM +0100, Glynn Clements wrote:

XDRIVER24 uses XFillPolygon's "Complex" mode, which should handle
self-intersecting polygons. However, there is a choice of two filling
rules: EvenOdd and WindingRule. From the XChangeGC manpage:

Yes, I played with them, they aren't the problem.

Problem is, there's no protocol for drawing polygons with holes. That
is, the inner "holes" of the polygon should mask out the drawing of the
outer polygon. I fooled around with d.area to create something of a
work around, but it isn't a very good implementation. This capability
needs to exist in the drivers so they can implement it however is best
for their "device". Built vector areas have the holes identified, so
it's at least partially a matter of passing this data to the driver for
appropriate behavior.

--
Eric G. Miller <egm2@jps.net>

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

Eric G. Miller wrote:

> XDRIVER24 uses XFillPolygon's "Complex" mode, which should handle
> self-intersecting polygons. However, there is a choice of two filling
> rules: EvenOdd and WindingRule. From the XChangeGC manpage:

Yes, I played with them, they aren't the problem.

Problem is, there's no protocol for drawing polygons with holes. That
is, the inner "holes" of the polygon should mask out the drawing of the
outer polygon. I fooled around with d.area to create something of a
work around, but it isn't a very good implementation. This capability
needs to exist in the drivers so they can implement it however is best
for their "device". Built vector areas have the holes identified, so
it's at least partially a matter of passing this data to the driver for
appropriate behavior.

So, the issue is that the drivers can only draw "polygons", leaving no
simple way to fill arbitrary "paths" like PostScript can?

In which case, this isn't likely to get fixed any time soon; even
lifting Mesa's GLU-1.2 tesselator won't help. We would need the
equivalent of the GLU-1.3 tesselator; given that Mesa's current stance
is "use SGI's GLU library", I'm not expecting a GPL'd version to
become available any time soon.

--
Glynn Clements <glynn.clements@virgin.net>

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

Hello,

I have applied a change to the NVIZ startup script for more flexible
handling of parameters. The -h and -help flags are still handled by TCL,
but all aother arguments are now passed to NVWISH.

This way the arguments are handled by the G_parser allowing more
flexible entry.

eg. nviz2.2 e=test.dem ve=contours site=data2

--
Bob Covill

Tekmap Consulting
P.O. Box 2016 Fall River, N.S.
B2T 1K6
Canada

E-Mail: bcovill@tekmap.ns.ca
Phone: 902-860-1496
Fax: 902-860-1498

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

On Thu, May 03, 2001 at 12:09:08AM +0100, Glynn Clements wrote:

Eric G. Miller wrote:

> > XDRIVER24 uses XFillPolygon's "Complex" mode, which should handle
> > self-intersecting polygons. However, there is a choice of two filling
> > rules: EvenOdd and WindingRule. From the XChangeGC manpage:
>
> Yes, I played with them, they aren't the problem.
>
> Problem is, there's no protocol for drawing polygons with holes. That
> is, the inner "holes" of the polygon should mask out the drawing of the
> outer polygon. I fooled around with d.area to create something of a
> work around, but it isn't a very good implementation. This capability
> needs to exist in the drivers so they can implement it however is best
> for their "device". Built vector areas have the holes identified, so
> it's at least partially a matter of passing this data to the driver for
> appropriate behavior.

So, the issue is that the drivers can only draw "polygons", leaving no
simple way to fill arbitrary "paths" like PostScript can?

I'm not sure what you mean. 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/
       ---------

What I did with d.area is connect every inner "hole" with the outer
polygon via the shortest pair of colinear line segments I could make
from existing vertices. It's rather a slow process though, especially
when the polygons are very large. Also, I think there are cases where
it will produce poor results since it doesn't check if the shortest path
between a hole and the outside crosses another hole.

In which case, this isn't likely to get fixed any time soon; even
lifting Mesa's GLU-1.2 tesselator won't help. We would need the
equivalent of the GLU-1.3 tesselator; given that Mesa's current stance
is "use SGI's GLU library", I'm not expecting a GPL'd version to
become available any time soon.

No idea about such things...

--
Eric G. Miller <egm2@jps.net>

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

Eric G. Miller wrote:

> > > XDRIVER24 uses XFillPolygon's "Complex" mode, which should handle
> > > self-intersecting polygons. However, there is a choice of two filling
> > > rules: EvenOdd and WindingRule. From the XChangeGC manpage:
> >
> > Yes, I played with them, they aren't the problem.
> >
> > Problem is, there's no protocol for drawing polygons with holes. That
> > is, the inner "holes" of the polygon should mask out the drawing of the
> > outer polygon. I fooled around with d.area to create something of a
> > work around, but it isn't a very good implementation. This capability
> > needs to exist in the drivers so they can implement it however is best
> > for their "device". Built vector areas have the holes identified, so
> > it's at least partially a matter of passing this data to the driver for
> > appropriate behavior.
>
> So, the issue is that the drivers can only draw "polygons", leaving no
> simple way to fill arbitrary "paths" like PostScript can?

I'm not sure what you mean. 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.

What I did with d.area is connect every inner "hole" with the outer
polygon via the shortest pair of colinear line segments I could make
from existing vertices. It's rather a slow process though, especially
when the polygons are very large. Also, I think there are cases where
it will produce poor results since it doesn't check if the shortest path
between a hole and the outside crosses another hole.

A correct solution is far from straightforward, as the Mesa[1] folks
have discovered.

[1] Mesa is a GPL'd implementation of the OpenGL API.

> In which case, this isn't likely to get fixed any time soon; even
> lifting Mesa's GLU-1.2 tesselator won't help. We would need the
> equivalent of the GLU-1.3 tesselator; given that Mesa's current stance
> is "use SGI's GLU library", I'm not expecting a GPL'd version to
> become available any time soon.

[NB: I was off by one (or rather, by point-one) with the GLU versions.]

No idea about such things...

A quick run-down:

OpenGL polygons have to be convex. In order to draw non-convex
polygons, or polygons with "holes", you have to tessellate the shape
into a set of convex polygons. To facilitate this, the GLU (GL
Utilities) library provides a "tessellator" API.

The API in GLU 1.1 would tessellate non-convex polygons, including
self-intersecting polygons, but it didn't directly allow for polygons
containing "holes". It was possible to get around this problem by
inserting a pair of co-linear edges to connect the hole with the
perimiter; however, this required the application to be able to figure
out which vertices to join.

GLU 1.2 introduced a new tessellator API, which allowed shapes to be
specified as multiple closed paths, which were then added or
subtracted using the appropriate fill-rule.

For a long time, the one feature missing from Mesa was the GLU 1.2
tessellator. Several people discussed implementing it, but nobody
managed to come up with the goods (a GLU 1.2 tessellator was included
in 3.1b3; it was removed in 3.2.1 because it didn't work).

Now, the Mesa website recommends using SGI's GLU library (free, but
not GPL) instead of there own, which suggests that they've given up on
being able to solve this particular problem.

In short, this "bug" isn't likely to be fixed soon.

--
Glynn Clements <glynn.clements@virgin.net>

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

On Thu, May 03, 2001 at 03:24:59AM +0100, Glynn Clements wrote:`

> I'm not sure what you mean. 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.

Understand, but this is a real world requirement for *any* GIS that does
vectors.

> What I did with d.area is connect every inner "hole" with the outer
> polygon via the shortest pair of colinear line segments I could make
> from existing vertices. It's rather a slow process though, especially
> when the polygons are very large. Also, I think there are cases where
> it will produce poor results since it doesn't check if the shortest path
> between a hole and the outside crosses another hole.

A correct solution is far from straightforward, as the Mesa[1] folks
have discovered.

[1] Mesa is a GPL'd implementation of the OpenGL API.

I knew that :wink:

> > In which case, this isn't likely to get fixed any time soon; even
> > lifting Mesa's GLU-1.2 tesselator won't help. We would need the
> > equivalent of the GLU-1.3 tesselator; given that Mesa's current stance
> > is "use SGI's GLU library", I'm not expecting a GPL'd version to
> > become available any time soon.

[NB: I was off by one (or rather, by point-one) with the GLU versions.]

> No idea about such things...

A quick run-down:

OpenGL polygons have to be convex. In order to draw non-convex
polygons, or polygons with "holes", you have to tessellate the shape
into a set of convex polygons. To facilitate this, the GLU (GL
Utilities) library provides a "tessellator" API.

The API in GLU 1.1 would tessellate non-convex polygons, including
self-intersecting polygons, but it didn't directly allow for polygons
containing "holes". It was possible to get around this problem by
inserting a pair of co-linear edges to connect the hole with the
perimiter; however, this required the application to be able to figure
out which vertices to join.

GLU 1.2 introduced a new tessellator API, which allowed shapes to be
specified as multiple closed paths, which were then added or
subtracted using the appropriate fill-rule.

For a long time, the one feature missing from Mesa was the GLU 1.2
tessellator. Several people discussed implementing it, but nobody
managed to come up with the goods (a GLU 1.2 tessellator was included
in 3.1b3; it was removed in 3.2.1 because it didn't work).

Now, the Mesa website recommends using SGI's GLU library (free, but
not GPL) instead of there own, which suggests that they've given up on
being able to solve this particular problem.

In short, this "bug" isn't likely to be fixed soon.

I think your being a little too pessimistic here. The OpenGL scenario
has several issues not present in a 2d representation. Also, I'm sure
there was considerable concern about the speed of the implementation,
since GL is used in games and such where the image needs to change
rapidly (less of a concern here).

Besides, I *know* this problem is solvable (even if I don't have the
solution yet). The weak solution would be just to rasterize all of
the fill areas in a seperate buffer and then "overlay" that on the
current display buffer. I considered that approach for d.area but
haven't yet tried it to see if it's faster for large data sets (I
assumed not).

--
Eric G. Miller <egm2@jps.net>

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

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@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@geog.uni-hannover.de with
subject 'unsubscribe grass5'

Eric G. Miller wrote:

> > I'm not sure what you mean. 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.

Understand, but this is a real world requirement for *any* GIS that does
vectors.

I can understand that there may be a need for handling arbitrary
vector "shapes", but those needs may well go beyond just drawing the
shapes.

I think your being a little too pessimistic here. The OpenGL scenario
has several issues not present in a 2d representation.

OpenGL also assumes that polygons are planar, which basically reduces
the problem to 2d:

1. Project the polygon onto a 2d plane.
2. Compute which edges need to be split and where
3. perform the actual interpolation using the 3d coordinates.

It's part 2 that's hard, and that's a 2d problem.

Also, I'm sure
there was considerable concern about the speed of the implementation,
since GL is used in games and such where the image needs to change
rapidly (less of a concern here).

Not really.

1. Because the GLU tessellator is just a library which uses the
lower-level GL polygon facilities, you would typically call the GLU
tessellation functions while constructing a display list. The display
list would comprise the individual convex polygons, so you wouldn't
necessarily have to continually re-tessellate the polygon.

2. OpenGL isn't just for games. Mesa possibly more so, as its primary
focus has tended to be with software rendering. In any case, I'm
fairly sure that they would have settled for a slow tessellator in
preference to no tessellator.

3. Game developers normally circumvent the entire problem by ensuring
that the source data is built entirely from convex polygons.
Furthermore, it's quite common to use just triangles, as even the most
geometrically illiterate 3d modeller simply cannot create a non-convex
triangle.

Besides, I *know* this problem is solvable (even if I don't have the
solution yet).

I know that it's solvable (SGI have a working GLU 1.2 tessellator). I
also know that it's not a five-minute job.

The weak solution would be just to rasterize all of
the fill areas in a seperate buffer and then "overlay" that on the
current display buffer. I considered that approach for d.area but
haven't yet tried it to see if it's faster for large data sets (I
assumed not).

If d.area converts to rasters, the HTMLMAP driver isn't likely to be
much use.

More generally, rasterisation reduces the information content.
Presumably there are other vector operations which should be able to
handle shapes which aren't convex polygons.

--
Glynn Clements <glynn.clements@virgin.net>

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

Justin Hickey wrote:

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

I'm familiar with that; however, tessellation seems to be a harder
problem than rasterisation (or, at least, if you discount the
degenerate case of having many narrow polygons).

Whilst we could just rasterise the areas in software for some of the
drivers, this won't work for HTMLMAP (other than by outputting a map
comprising lots of 1x1-pixel rectangles).

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

I disagree; routines to tessellate arbitrary shapes into a set of
non-overlapping convex polygons would be much more useful. It would
make writing many vector algorithms much simpler.

--
Glynn Clements <glynn.clements@virgin.net>

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

On Thu, May 03, 2001 at 05:32:31AM +0100, Glynn Clements wrote:

> I think your being a little too pessimistic here. The OpenGL scenario
> has several issues not present in a 2d representation.

OpenGL also assumes that polygons are planar, which basically reduces
the problem to 2d:

1. Project the polygon onto a 2d plane.
2. Compute which edges need to be split and where
3. perform the actual interpolation using the 3d coordinates.

It's part 2 that's hard, and that's a 2d problem.

> Also, I'm sure
> there was considerable concern about the speed of the implementation,
> since GL is used in games and such where the image needs to change
> rapidly (less of a concern here).

Not really.

1. Because the GLU tessellator is just a library which uses the
lower-level GL polygon facilities, you would typically call the GLU
tessellation functions while constructing a display list. The display
list would comprise the individual convex polygons, so you wouldn't
necessarily have to continually re-tessellate the polygon.

2. OpenGL isn't just for games. Mesa possibly more so, as its primary
focus has tended to be with software rendering. In any case, I'm
fairly sure that they would have settled for a slow tessellator in
preference to no tessellator.

3. Game developers normally circumvent the entire problem by ensuring
that the source data is built entirely from convex polygons.
Furthermore, it's quite common to use just triangles, as even the most
geometrically illiterate 3d modeller simply cannot create a non-convex
triangle.

> Besides, I *know* this problem is solvable (even if I don't have the
> solution yet).

I know that it's solvable (SGI have a working GLU 1.2 tessellator). I
also know that it's not a five-minute job.

If it were a five-minute job, it'd be done already :wink: I'm well aware of
the difficulty and have been researching a solution that's correct and
efficient.

> The weak solution would be just to rasterize all of
> the fill areas in a seperate buffer and then "overlay" that on the
> current display buffer. I considered that approach for d.area but
> haven't yet tried it to see if it's faster for large data sets (I
> assumed not).

If d.area converts to rasters, the HTMLMAP driver isn't likely to be
much use.

True, but I wouldn't run d.area for HTMLMAP anyway, since the main point
of d.area is doing filled polygons (though d.vect doesn't currently
handle the hole scenario at all). I think HTMLMAP could be better done
as a module rather than a display target anyway.

More generally, rasterisation reduces the information content.
Presumably there are other vector operations which should be able to
handle shapes which aren't convex polygons.

Much of this problem is specific to drawing routines for fill. There
are some elements that would be applicable for union/intersect type
operations (though we need real attribute support before such things
will have much utility). When I was referring to rasterization, I was
specifically thinking of display. For hardcopy (map files) keeping
vector is better...

Happy Hacking!
--
Eric G. Miller <egm2@jps.net>

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

Eric G. Miller wrote:

> If d.area converts to rasters, the HTMLMAP driver isn't likely to be
> much use.

True, but I wouldn't run d.area for HTMLMAP anyway, since the main point
of d.area is doing filled polygons (though d.vect doesn't currently
handle the hole scenario at all).

HTMLMAP/README says:

  The only GRASS display commands that should be used with this driver are:
  d.text - pass href information for resulting image maps.
  d.area - draw polygons from a vector file.

I think HTMLMAP could be better done as a module rather than a
display target anyway.

Quite possibly, given that it's significantly more restricted than all
of the other "display" drivers. Although there may be some advantage
in being able to use command sequences similar to those used for
generating the image (e.g. with PNGDRIVER).

> More generally, rasterisation reduces the information content.
> Presumably there are other vector operations which should be able to
> handle shapes which aren't convex polygons.

Much of this problem is specific to drawing routines for fill. There
are some elements that would be applicable for union/intersect type
operations (though we need real attribute support before such things
will have much utility). When I was referring to rasterization, I was
specifically thinking of display. For hardcopy (map files) keeping
vector is better...

Yep; and it's not an issue for ps.map; PostScript handles shapes with
holes fine. If I were looking to rasterise complex shapes, I'd
probably look at ripping the code from Ghostscript.

--
Glynn Clements <glynn.clements@virgin.net>

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

Hi Glynn and Eric

Glynn Clements wrote:

I disagree; routines to tessellate arbitrary shapes into a set of
non-overlapping convex polygons would be much more useful. It would
make writing many vector algorithms much simpler.

Ahh yes, you're right. My mind was stuck in raster mode. :slight_smile:

But there should be a tessellation algorithm out there somewhere. I
looked in the Computer Graphics book I mentioned and the only reference
to tesselation is a question left for students. However, there is a
reference for a book with that question. The book is "Computational
Geometry: An introduction" by F. P. Preparata and M. I. Shamos. Perhaps
this book (or another one with the same subject) has an algorithm we can
use or modify? Just a suggestion.

--
Sincerely,

Jazzman (a.k.a. Justin Hickey) e-mail: jhickey@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@geog.uni-hannover.de with
subject 'unsubscribe grass5'