home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!stanford.edu!rutgers!rochester!cantaloupe.srv.cs.cmu.edu!bam
- From: bam+@BAM.GARNET.CS.CMU.EDU (Brad Myers)
- Newsgroups: cmu.cs.general,comp.graphics
- Subject: Help with sorting rectangles
- Message-ID: <1992Jul31.184332.125762@cs.cmu.edu>
- Date: 31 Jul 92 18:43:32 GMT
- Organization: School of Computer Science, Carnegie Mellon
- Lines: 23
- Nntp-Posting-Host: bam.garnet.cs.cmu.edu
- Originator: bam@BAM.GARNET.CS.CMU.EDU
-
-
- Does anyone know an algorithm for sorting rectangles in row-major order?
- The problem is that they might not be exactly aligned. For example:
-
- |-----|
- |----| | B | |-----|
- | A | | | | C |
- |____| |-----| |_____|
-
- |-----| |-----|
- | D ||-----| | F |
- |-----|| E | | |
- |_____| |-----|
-
-
- I want to get the order ABCDEF which is "clearly obvious", but notice
- that D has an X value that is less than A, and B has a Y value that is
- less than A (assuming 0,0 at the top), so simply sorting by X and then
- Y (or vice versa) fails. Surely, someone has solved this problem already!
-
- Thanks for your help!
- Brad Myers
- bam@cs.cmu.edu
-