Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://570006]
help
Chatterbox?
[karlgoethebier]: james28909: I don't know. Try it.
[james28909]: foreach server this bot is on, the gateway sends me a json response, which i parse out all the info with JSON, and this response has user information, i need to be able to add a user, and then update the user info when they join/leave rooms ect
[james28909]: i think im good
[james28909]: i just watched a youtube video
[karlgoethebier]: james28909: Did you look on CPAN?
[james28909]: lol
[karlgoethebier]: james28909: Super Search here ?
[karlgoethebier]: james28909: No kidding

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2017-05-25 16:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?