in reply to Speeding up point-in-polygon -- take two
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
|
---|