The stupid question is the question not asked | |
PerlMonks |
Re: reordering segments to form a polygonby Random_Walk (Prior) |
on Aug 13, 2004 at 10:42 UTC ( [id://382605]=note: print w/replies, xml ) | Need Help?? |
someone beat me to it but I coded it so I might as well post it.
This will not play nice if your polygon is not closed. Cheers, code seriously tidied up, posted too hastily. The print can be replaced with a push of $seg[$i] onto a new ordered array for use as a sub of other code. Thought I'd add a quick comment on how it works
The first loop reads each element of the array and records its index number in a hash keyed by starting point.
In Section
Seekers of Perl Wisdom
|
|