Unroll the condition and duplicate the process (or subroutine):
Or a simple calculation:if ( $y[i] <= $y ) { if ( $y < $y[$j] ) { # process ... } } elsif ( $y >= $y[$j] ) { # the same process .. }
Remember: Memoize is your friend.if ( ( $y[$i] - $y ) * ( $y - $y[$j] ) > 0 ) { # process
In reply to Re: Speeding up point-in-polygon -- take two
by explorer
in thread Speeding up point-in-polygon -- take two
by punkish
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |