home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 20713 < prev    next >
Encoding:
Text File  |  1993-01-05  |  1.5 KB  |  45 lines

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