Polygons concatenation

Started by
3 comments, last by MV 19 years, 11 months ago
Does someone know an algorithm to make a single polygon from 2 polygons (coplanar) sharing one (or more) edge ? Please help, I''m stucked !!!
Advertisement
can the original polygons overlap? Can there be a hole in the new "polygon"? Can it be any number of shared edges or only 1 or 2?
Overlap ? Do you mean intersecting ? The answer should be no...

No hole and the number of shared edges should be 1 or 2.

I dit a concave -> convexe algorithm ; a concave polygon can be splitted in many convexe polygons (that I called the childs of the original concave polygon). Now, one of the convexe child can get concave, so what I want to do is to get the childs back to the original polygon so that I can apply my algorithm again.
There could be 2 shared edges because the edge between 2 childs is splitted in 2 pieces.

Hope this make sense
Well I assume you have your polygons as a ordered set of points (ordered clockwise or counter-clockwise)*. I´d start at one point P that isn´t shared by the two polygons. Then, trace the polygon edges and keep them in mind (memory) for they will form the big one. If you hit a shared point continue that tracing on the other polygon. If you hit your original point P again you´re done.
I never did that myself so it´s just a hint what I´d try.

*: You metioned that the tow polygons were one originally. In that case same ordering of both should be sufficient. In other cases you might have to check if the facing normals of both point in the same or in the opposite direction. You´d have to reverse ordering for one of the two polygons in the latter case.
hmmm... quite clever ...
I was waiting for something like a standart algorithm but this sounds ok. Thx man ! I''ll try this.

This topic is closed to new replies.

Advertisement