home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / graphics / 8328 < prev    next >
Encoding:
Internet Message Format  |  1992-07-31  |  1.1 KB

  1. Path: sparky!uunet!stanford.edu!rutgers!rochester!cantaloupe.srv.cs.cmu.edu!bam
  2. From: bam+@BAM.GARNET.CS.CMU.EDU (Brad Myers)
  3. Newsgroups: cmu.cs.general,comp.graphics
  4. Subject: Help with sorting rectangles
  5. Message-ID: <1992Jul31.184332.125762@cs.cmu.edu>
  6. Date: 31 Jul 92 18:43:32 GMT
  7. Organization: School of Computer Science, Carnegie Mellon
  8. Lines: 23
  9. Nntp-Posting-Host: bam.garnet.cs.cmu.edu
  10. Originator: bam@BAM.GARNET.CS.CMU.EDU
  11.  
  12.  
  13. Does anyone know an algorithm for sorting rectangles in row-major order?
  14. The problem is that they might not be exactly aligned.  For example:
  15.  
  16.          |-----|
  17.   |----| |  B  | |-----|
  18.   | A  | |     | |  C  |
  19.   |____| |-----| |_____|
  20.         
  21. |-----|         |-----|
  22. | D   ||-----|  |  F  |
  23. |-----||  E  |  |     |
  24.        |_____|  |-----|
  25.  
  26.  
  27. I want to get the order ABCDEF which is "clearly obvious", but notice
  28. that D has an X value that is less than A, and B has a Y value that is
  29. less than A (assuming 0,0 at the top), so simply sorting by X and then
  30. Y (or vice versa) fails.  Surely, someone has solved this problem already!
  31.  
  32. Thanks for your help!
  33. Brad Myers
  34. bam@cs.cmu.edu
  35.