[cairo] Hit detect surface?

Leon Woestenberg leonw at mailcan.com
Wed Mar 1 15:31:32 PST 2006


Hello all,

Bill Spitzak wrote:
> To find the nearest, you must draw several times, with smaller and 
> smaller squares, until either you reach a minimum size, or only one 
> object is detected (or it goes to zero, in which case you use the 
> previous pass). (actually now that I think about it, it may be more 
> efficient to start at the minimum size and go up until you hit 
> something.) 
Can a 'binary search' algorithm be even more speedy in this regard?

test a middle sized square, if hit detected halve the square size, else 
double square size, repeat and rinse.

Regards,

Leon.


More information about the cairo mailing list