home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.graphics
- Path: sparky!uunet!wupost!emory!cs.utk.edu!willis1.cis.uab.edu!sloan
- From: sloan@cis.uab.edu (Kenneth Sloan)
- Subject: Re: Polygon-polygon intersection
- Message-ID: <1993Jan4.195436.2889@cis.uab.edu>
- Organization: CIS, University of Alabama at Birmingham
- References: <7418@tivoli.UUCP>
- Date: Mon, 4 Jan 1993 19:54:36 GMT
- Lines: 37
-
- In article <7418@tivoli.UUCP> twb@tivoli.com (Tom Bereiter) writes:
- >I'm looking for an efficient test for whether two 2D polygons intersect.
- >The brute force approach seems to be: do a point-in-polygon test for each
- >point of polyA in polyB, but if that says false you still have to check for
- >line intersections. This feels like the sort of problem, like area of
- >a polygon, which has a non-obvious trivial answer.
- >
- Sorry, but I don't think there is a "non-obvious trivial answer". In
- the final analysis, I think you need:
-
- *for all Va - is Va inside Pb
- *for all Vb - is Vb inside Pa
- *for all Ea - does Ea interect any Eb
-
- But - depending on your distribution of polygons, there may be numerous
- "quick kills" - usually "trivial reject"-type tests. Whether trying
- these first is "efficient" or not depends on your set of polygons.
-
- I would try (in order):
-
- *X-overlap
- *Y-overlap
- *all Va outside convex hull of Pb
- *all Vb outside convex hull of Pa
-
- and then bite the bullet and go for the three tests above.
-
- But....this is probably only worthwhile if your polygons are complicated
- (have a lot of vertices, or are concave). If your polygons are
- triangles, or convex quadrilaterals...start with brute force.
-
-
- --
- Kenneth Sloan Computer and Information Sciences
- sloan@cis.uab.edu University of Alabama at Birmingham
- (205) 934-2213 115A Campbell Hall, UAB Station
- (205) 934-5473 FAX Birmingham, AL 35294-1170
-