Re: Companion question to polygon winding rule




Bint wrote:
> Hello,
>
> I wrote in a question about the polygon winding rule a couple of
> days ago. I have a question that goes along with it, which has to
> do with the outline of a complex polygon.
>
> If I fill a polygon that intersects itself so that the holes are
> filled in, is there an easy way to detect which edges are inside
> the polygon so that I don't draw them either? For example, a
> five-pointed star drawn like a kid would, as intersecting triangular
> lines, I would want to appear as an outlined solid star.
>
> Thanks for any tips.
> Bint

Maxim Shemanarev (McSeem) -- http://antigrain.com/ -- posted this same
question about two months ago:
<http://groups.google.com/group/comp.graphics.algorithms/browse_frm/thread/44516af8ae7ec064/7b80bb13a1b082f7#7b80bb13a1b082f7>

I believe Maxim adopted my suggestion to:
1) Split the edges by creating new vertices at edge intersections;
2) Create an edge list of these new split edges (each edge then can
record the winding count on each side of it); and (starting from
the left-most vertex)
3) Trace the edges that have a zero winding on the right and a non-
zero winding on the left. This imples that you will traverse the
resulting simple polygon(s) in a CCW direction.

Step 3 has to be performed iteratively until all edges have been
traced, since your particular configuration of edges may yield multiple

polygons.

I leave it to you to decide if this is "easy", but I do believe it's
the most direct and robust way to do this.

Bob

.



Relevant Pages

  • Re: Point Inside Polygon - Ray Method
    ... polygon went counterclockwise around the point. ... winding numbers may exceed 1 if the polygon isn't simple. ... If the boundary of a plane region is a simple closed curve, then one ray ...
    (sci.math)
  • Re: Point Inside Polygon - Ray Method
    ... There is an alternative method called "winding". ... Define the quadrants in the usual manner, except use q for the origin. ... Traverse the polygon. ... If the final winding count is 0, ...
    (sci.math)
  • Re: Clipping does not work properly with ATI specific card.
    ... behavior (backface, winding etc). ... If polygon mode is GL_LINE, ... Clipping is performed before the polygon mode takes place, ...
    (comp.graphics.api.opengl)
  • Re: Point Inside Polygon - Ray Method
    ... polygon went counterclockwise around the point. ... winding numbers may exceed 1 if the polygon isn't simple. ... Perhaps strict convexity would be a sufficient condition for three ...
    (sci.math)
  • Re: Detect circle overlapping line
    ... the circle intersects the lines making up the polygon. ... That's true but you will be able to tell if the circle outside the polygon ... That shouldn't be too much of an issue, just treat the holes as seperate ...
    (microsoft.public.dotnet.framework.drawing)