Re: Polygon with holes

• To: mathgroup at smc.vnet.net
• Subject: [mg97433] Re: Polygon with holes
• From: ragfield <ragfield at gmail.com>
• Date: Fri, 13 Mar 2009 04:49:37 -0500 (EST)
• References: <gp5fn9\$9mc\$1@smc.vnet.net> <gp7vsh\$1cv\$1@smc.vnet.net>

```On Mar 12, 5:42 am, Harrie Kraai <hakr... at xs4all.nl> wrote:
> Thanks for this suggestion. However, (as you are porbably aware) it does
> not work so easily for arbitrary polygons. The connection between inner
> and outer contours is made by a straight line. A general algorithm would
> have to select the points to be connected and make sure that the
> connection itself does not intersect the contours. There should also be
> a check on the orientations. Making two or more holes would complicate
> things further.

It shouldn't matter whether the lines cross the contours or not, so
long as the exact same line is followed in reverse order at the end
(which my earlier example does).  It's possible the implementation of
this algorithm in Mathematica code I provided earlier has a bug (I
didn't test it thoroughly, if you have an example where it fails I'd
be interested in seeing it), but the algorithm works and is completely
general.

Mathematica's built-in PDF import support appears to use the same
algorithm for converting arbitrary multi-contour PDF paths into
Mathematica Polygon primitives. Take a look at:

Import["ExampleData/mathematica.pdf"]

Notice the output for the "e", "a", and "i" characters.  The only
caveat (of which I'm aware) of using this algorithm is that if you try
to print a graphic containing one of these polygons to a PostScript
printer, some PostScript printers will interpret the 0-width segment
to be 1 device pixel wide (so lines do appear even though they cover
zero area).

> As I expected there seems to be no simple facility available. This could
> be a feature request for wolfram. How do I submit one?

Try this:

http://support.wolfram.com/submitabug.cgi

-Rob

```

• Prev by Date: Re: Mathematica 7.0.1.0 and some General Comments
• Next by Date: Shooting Method Help
• Previous by thread: Re: Polygon with holes
• Next by thread: Re: Polygon with holes