Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!aurora!eos!ames!hao!gatech!ncsuvx!mcnc!unccvax!jow From: jow@unccvax.UUCP (Jim Wiley) Newsgroups: comp.graphics Subject: Re: COMPLICATED PROBLEM; ONLY INTELLIGENT PEOPLE SHOULD READ Message-ID: <917@unccvax.UUCP> Date: 26 Feb 88 07:38:35 GMT References: <971@ut-emx.UUCP> <210@geza.SW.MCC.COM> <21223@bbn.COM> Organization: Univ. of NC at Charlotte, Charlotte, NC Lines: 15 In article <21223@bbn.COM>, cosell@bbn.com (Bernie Cosell) writes: > that comes to mind quickly for arbitrary (!!) regions is to find a point > *known* to be outside the region and then take the line segment from the > point-being-tested to the known-outside-point. Now check how many > region-boundary segments this line segment intersects. If the number is > odd, then the point is inside the region, if even it is outside the region. > (if you handle "intesection" properly, you can just pick an endpoint of one > of the region-boundary lines as the known-outside point). also note that Intersection is not good enough. A line drawn between to outside points can be tangent to the region and "intersect" at only one point thus producing a false inside indication. The number of times the line segment crosses the region boundry must be counted. Jim Wiley