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]
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.