in reply to searching polygons not merged
but that example performance is really bad
This will run in less than half the time:
while (my $polygon1 = shift @polygon) { foreach my $polygons2(@polygon){ # Comparison code here } }
Additionally, I'd probably create an array of the smallest circles which enclose all the vertices of each polygon before starting the main loop. If the two circles don't overlap (an easy calc) then the two polygons won't either. That will reduce the number of more expensive calcs required.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: searching polygons not merged
by LanX (Saint) on Oct 27, 2018 at 15:59 UTC | |
by hippo (Archbishop) on Oct 28, 2018 at 10:05 UTC | |
by LanX (Saint) on Oct 28, 2018 at 12:07 UTC | |
by hippo (Archbishop) on Oct 28, 2018 at 14:51 UTC | |
by haj (Vicar) on Oct 28, 2018 at 19:39 UTC | |
| |
by LanX (Saint) on Oct 28, 2018 at 17:56 UTC | |
| |
by LanX (Saint) on Oct 28, 2018 at 18:33 UTC |