Hi Monks:). I know monks are professional perler:) My question is where is easy and nice module to combine polygon.. I searched all of perl module site. and I got Math::polygon. This module gave me many functions. There are calculating area, perimeter, searching point in polygon etc.. But I want to achieve to combine polygons. Unfortunately that module has not that function.. Below examples, I show only rectangular but it is not always rectangular, sometimes polygons.. Also that polygons have not hole and always have minimum 5 points. Is there any nice idea? or modules you know to combine polygons? I couldn't sleep because of that problems.. Please help me
#case 1 => There is common area. merge case
my @poly1 = ([0,0],[0,2],[2,2],[2,0],[0,0]);
my @poly2 = ([0,0],[3,0],[3,1],[0,1],[0,0]);
my @merge_poly12;
print ("@merge_poly12\n"); #then I want to print [0,0],[0,2],[2,2],[2,
+1],[3,1],[3,0],[0,0];
#case 2 => There is not common area, No merge
my @poly1 = ([0,0],[0,2],[2,2],[2,0],[0,0]);
my @poly3 = ([3,0],[3,2],[4,2],[4,0],[3,0]);
my @merge_poly13;
print ("@merge_poly13\n"); # then I want to print nothing or only @pol
+y1.
#case 3 => There is not common area, But have line, Merge case
my @poly1 = ([0,0],[0,2],[2,2],[2,0],[0,0]);
my @poly4 = ([0,2],[0,3],[1,3],[1,2],[0,2]);
my @merge_poly13;
print ("@merge_poly14\n"); # then I want to print [0,0],[0,3],[1,3],[
+1,2],[2,2],[2,0],[0,0]
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.