home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!charnel!sifon!thunder.mcrcim.mcgill.edu!snorkelwacker.mit.edu!ai-lab!fiber-one!sundar
- From: sundar@fiber-one.ai.mit.edu (Sundar Narasimhan)
- Newsgroups: comp.graphics
- Subject: Re: Polygon (or point) within an arbitrary polygon
- Message-ID: <1egv39INNj29@life.ai.mit.edu>
- Date: 19 Nov 92 20:57:13 GMT
- References: <HINKER.92Nov19081251@cocker.acl.lanl.gov>
- Sender: sundar@fiber-one (Sundar Narasimhan)
- Reply-To: sundar@ai.mit.edu
- Organization: MIT Artificial Intelligence Laboratory
- Lines: 23
- NNTP-Posting-Host: fiber-one.ai.mit.edu
-
- In article <HINKER.92Nov19081251@cocker.acl.lanl.gov>, hinker@acl.lanl.gov (Paul J. Hinker) writes:
- |> I have Polygon1 and Polygon2 described by their respective vertice
- |> lists and bounding boxes and I would like to find out whether or not
- |> Polygon1 *contains* Polygon2. Nothing else is known about either
- |> polygon.
- This problem (like the polygon intersection problem) can be solved
- by computing the convolution of the two polygons -- for which linear
- time algorithms exist in the plane.
-
- Let's say you have polygon A, B. First let's consider determining
- if A intersects B. To do this imagine shrinking B to a point, and growing A
- by the similar amount. Now if the point representing B is in the
- grown polygon GO_B(A) (read that as "grown obstacle A relative to B),
- then they must intersect. What do I mean by "growing A by a similar amount"?
- I mean that A is replaced by the convolution of the two polygons A and
- -B (negated copy of B where every vertex V_i in B has been replaced by -V_i).
- Thus queries about intersection can be reduced to the point in polygon
- problem.
-
- Your containment problem is essentially the same. If you consider
- the complement of A, your problem is deciding if B intersects complement of
- A. Note that generating complements is extremely easy (just switch
- the signs of edge-normal information - or change ccw polygons to cw ones).
-