Re: Companion question to polygon winding rule
- From: "Bob Williamson" <rwillia1@xxxxxxxxx>
- Date: 9 Sep 2005 08:31:51 -0700
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
.
- References:
- Companion question to polygon winding rule
- From: Bint
- Companion question to polygon winding rule
- Prev by Date: bsplines question
- Next by Date: Re: Polyarc offset
- Previous by thread: Companion question to polygon winding rule
- Next by thread: Maya IFF images
- Index(es):
Relevant Pages
|