in reply to Re^2: Permutation and comparison loop
in thread Permutation and comparison loop

#! perl -slw use strict; use enum qw[ IMAGENO MINLAT MAXLAT MINLON MAXLON ]; sub overlapLat { my( $a, $b ) = @_; return if $a->[MINLAT]+90 > $b->[MAXLAT]+90 or $a->[MAXLAT]+90 < $b->[MINLAT]+90; return 1; } sub overlapLon { my( $a, $b ) = @_; return if $a->[MINLON]+360 > $b->[MAXLON]+360 or $a->[MAXLON]+360 < $b->[MINLON]+360; return 1; } ##discard header <DATA>; my @rects = map[ split ',' ], <DATA>; for my $first ( 0 .. $#rects ) { for my $second ( $first + 1 .. $#rects ) { if( overlapLat( @rects[ $first, $second ] ) and overlapLon( @rects[ $first, $second ] ) ) { print "@{$rects[ $first ] } overlaps \n@{ $rects[ $second +] }"; } } } __DATA__ "Image number","minlat","maxlat","minlon","maxlon" ...

Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.