I have had to do this exact same thing previously. Are you doing GIS work? What type of data are these 'points'? Are they simple graph plots, lat-long pairs, etc? Even if you are not doing GIS work do a google search on 'gis perl' or start at http://freegis.org
You can basically do this:
1 .........
2 . .
3 . ........
4 . . .
5 . . .
6 . ........
7 . .
8 .........
1234567891111111
0123456
Given the two adjacent polygons above, you essentially want to remove the points between 9,6 and 9,3. All you need to do is sort each list of points and remove the matching set. Be sure to leave the 'leftmost' and 'rightmost' matching set though. I would do as suggested and order each polygon either clockwise or counter clockwise. This should work out just fine for you. If you need more clarification or help, just ask.
If done carefully, you will end up with the following. Please correct me if I'm wrong in my assumptions.
1 .........
2 . .
3 . ........
4 . .
5 . .
6 . ........
7 . .
8 .........
1234567891111111
0123456
| [reply] [d/l] [select] |
Yes...they would be touching. | [reply] |
I second the recommendation for the module Math::Geometetry::Planar, especially the GpcClip UNION operation. It is capable of dealing with concave polygons and polygons with holes. | [reply] |