Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Speeding up point-in-polygon -- take two

by explorer (Chaplain)
on Aug 28, 2006 at 16:35 UTC ( #570006=note: print w/ replies, xml ) Need Help??


in reply to Speeding up point-in-polygon -- take two

Unroll the condition and duplicate the process (or subroutine):

if ( $y[i] <= $y ) { if ( $y < $y[$j] ) { # process ... } } elsif ( $y >= $y[$j] ) { # the same process .. }
Or a simple calculation:
if ( ( $y[$i] - $y ) * ( $y - $y[$j] ) > 0 ) { # process
Remember: Memoize is your friend.


Comment on Re: Speeding up point-in-polygon -- take two
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://570006]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (4)
As of 2014-11-27 22:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (188 votes), past polls