home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!mcsun!sunic!kth.se!dront.nada.kth.se!d88-jwa
- From: d88-jwa@dront.nada.kth.se (Jon WΣtte)
- Subject: Re: Detecting mouseDown in a region?
- Message-ID: <1993Jan5.200855.14498@kth.se>
- Sender: usenet@kth.se (Usenet)
- Nntp-Posting-Host: dront.nada.kth.se
- Organization: Royal Institute of Technology, Stockholm, Sweden
- References: <1993Jan5.171920.29754@fsl.noaa.gov>
- Date: Tue, 5 Jan 1993 20:08:55 GMT
- Lines: 32
-
- In <1993Jan5.171920.29754@fsl.noaa.gov> urban@yoda.fsl.noaa.gov (Art Urban) writes:
-
- >become slow if the user clicks in the 1000th region. Is there any way I can
- >reduce the possibilities?
-
- Several.
-
- 1) you could form meta-regions that are unions of the other
- regions. Let's say you have 30 meta regions - you'll only
- have to loop those 30, and then the 35 associated with
- that meta region.
-
- 2) The above could generalize to a logarithmic search; form
- meta-regions of meta-regions. This will give you a guaranteed
- bound of log2 PtInRgn calls, at the expense of memory. You
- could loosen up the limit a little by using, say 10 meta-
- meta regions of 100 meta regions.
-
- 3) Sort the regions according to their boundingBox positions,
- and only consider regions that are bounded by the right
- position.
-
- I would probably choose 2) from the above.
-
- Cheers,
-
- / h+
-
- --
- -- Jon W{tte, h+@nada.kth.se, Mac Hacker Deluxe --
- This signature is kept shorter than 4 lines in the interests of UseNet
- S/N ratio.
-