home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / ai / 3097 < prev    next >
Encoding:
Internet Message Format  |  1992-08-14  |  3.6 KB

  1. Path: sparky!uunet!crdgw1!ge-dab!puma.ATL.GE.COM!puma!sjameson
  2. From: sjameson@atl.ge.com (Stephen M Jameson)
  3. Newsgroups: comp.ai
  4. Subject: Re: regions within regions
  5. Message-ID: <SJAMESON.92Aug13083908@fergie.atl.ge.com>
  6. Date: 13 Aug 92 12:39:08 GMT
  7. References: <3753@keele.keele.ac.uk>
  8. Sender: news@puma.ATL.GE.COM (USENET News System)
  9. Organization: General Electric Advanced Technology Labs
  10. Lines: 84
  11. In-Reply-To: csa09@seq1.keele.ac.uk's message of 10 Aug 92 15:22:41 GMT
  12.  
  13. In article <3753@keele.keele.ac.uk> csa09@seq1.keele.ac.uk (Paul Singleton) writes:
  14. > I have some regions in N-space, each defined by a simple set of constraints,
  15. > e.g.
  16. >     0 =< X =< 5         (1)
  17. >     0 =< Y =< 5         (2)
  18. >     2 =< Z =< 7         (3)
  19. >     0 =< X+Y =< 8       (4)
  20. > and I need an algorithm (for general N) to determine whether one region
  21. > completely encloses another.
  22.  
  23. This is based on about 5 minutes of pen-pushing, so it may need some smoothing
  24. of the rough edges, but your algorithm will be based on the following three
  25. facts:
  26.  
  27. 1.    Any pair of constraints on different dimensions:
  28.  
  29. >     0 =< X =< 5        (1)
  30. >     0 =< Y =< 5        (2)
  31.  
  32. Implies a constraint on their sum, which is well defined because of the
  33. limits your problem imposes on definition of the constraints.  In this case, we
  34. have:
  35.  
  36.     0 =< X + Y =< 10   (5)
  37.  
  38. 2.    Any two constraints:
  39.  
  40.     a =< X =< b
  41.     c =< X =< d
  42.  
  43. where X is a single dimension or a sum of dimensions, can be replaced by:
  44.  
  45.     max(a,c) =< X =< min(b,d)
  46.  
  47. Thus while constraints (1) and (2) above imply constraint (5), combining
  48. constraints (4) and (5) by the formula above gives constraint (4), i.e.
  49. constraint (4) is "tighter than" or "subsumes" (5).  Thus given any set of
  50. constraints on dimensions, you can eliminate duplicate constraints on the same
  51. dimension or sum of dimensions.
  52.  
  53. 3.    A region A defined by a set of constraints {a_i} is completely enclosed by
  54. another region B defined by {b_i} if and only if:
  55.  
  56.     a.    All of the dimensions (including sums of dimensions), which are
  57.         constrained {b_i} are also constrained by {a_i}.
  58.  
  59.     b.    For each constraint in {b_i}, the constraint in {a_i} constraining the
  60.         same dimension or sum of dimensions must be "tighter than" the
  61.         constraint in {b_i}.
  62.  
  63. Thus we have the following general algorithm:
  64.  
  65. Given a set of dimensions {X1, X2, .. Xn}, and two sets of constraints,
  66. {a_i} and {b_i}, where each constraint is of the form:
  67.  
  68.     k1_i <= X_i_1 + ... + X_i_n <= k2_i             (n may be 1)
  69.  
  70. Step 1.    For each set, using observation 1 above, generate all possible
  71. constraints on sums of dimensions.
  72.  
  73. Step 2.    For each set, using observation 2 above, eliminate all duplicate
  74. constraints in each set.
  75.  
  76. Step 3.    For each constraint in {b_i}, verify that there is a constraint in
  77. {a_i} which constrains the same dimension or sum of dimensions and is "tighter
  78. than" the constraint in {b_i}.  If this is the case for all constraints in
  79. {b_i}, then the region defined by {a_i} is completely enclosed by {b_i}.
  80.  
  81. Each step is fairly straightforward, so I won't generate pseudo-code here.
  82.  
  83.  
  84.  
  85.         
  86. --
  87. Steve Jameson                           General Electric Aerospace 
  88. sjameson@atl.ge.com                     Advanced Technology Laboratories
  89.                                         Moorestown, New Jersey              
  90. ****************************************************************************
  91. **  . . . but I do not love the sword for its sharpness, nor the arrow    **
  92. **  for its swiftness, nor the warrior for his glory.  I love only that   **
  93. **  which they defend . . .                                               **
  94. **    -- Faramir, "The Two Towers"                                        **
  95. ****************************************************************************
  96.