I did a speed comparison between my final InRect() function (the flexible one), and fredborg's code.
Fredborg your code took 4518 millisecs to do 10 million calls. My code took 4662. Yours is very slightly faster. Not all the time though. Sometimes I got better numbers on mine, not sure why.
My fixed-position code is about 4620 - getting closer. Strangely my square routine is a bit slower than my rect one. lol
But anyway, yes, Fredborg, congrats, your routine is actually the fastest so far (just ;-D)
Although THIS:
should be faster still. (It is, 4543 millisecs :-)
Interestingly >= and <= are slower than > and <.
Fredborg your code took 4518 millisecs to do 10 million calls. My code took 4662. Yours is very slightly faster. Not all the time though. Sometimes I got better numbers on mine, not sure why.
My fixed-position code is about 4620 - getting closer. Strangely my square routine is a bit slower than my rect one. lol
But anyway, yes, Fredborg, congrats, your routine is actually the fastest so far (just ;-D)
Although THIS:
Function PointInRect:Int(x:Int,y:Int,bx:Int,by:Int,bx2:Int,by2:Int) Return (x < bx2) & (y < by2) & (x > bx) & (y > by) End Function
should be faster still. (It is, 4543 millisecs :-)
Interestingly >= and <= are slower than > and <.