Message-ID: <351AD81E.E9F2939C@wpol.com> From: John & Sue Kissell Reply-To: jdk AT wpol DOT com MIME-Version: 1.0 Newsgroups: comp.os.msdos.djgpp Subject: Re: point inside polygon detection References: <6fce42$md4 AT bgtnsc02 DOT worldnet DOT att DOT net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 26 Date: Thu, 26 Mar 1998 19:25:48 GMT NNTP-Posting-Host: 208.195.214.68 NNTP-Posting-Date: Thu, 26 Mar 1998 14:25:48 EST To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk This may be total nonsense, but it seems to me that you should be able to compare the point's coordinates to the *average* location (+ or - 1/2 the size in X and Y) of the object's corner coordinates. This is easy to see with a plain (all right angle) rectangle, but without testing it could be absolute rubbish for non-regular objects. Hope this gives you some ideas, John Kissell Steve Patton wrote: > > Hi, > > Is there a quick easy way to detect whether a point lies within the > boundaries of a 2d polygon? Right now I'm dealing with a four sided > polygon. This shape could be a rectangle (at any rotation angle, or > distortion), trapazoid, etc, any 4 sided polygon. This has to be checked a > LOT, so I would appreciate an efficient algorithm. Source code is not > neccessary, if you can give me an idea, I can run with it. Thanks! > > -- > -Steve > Personal : http://home.att.net/~pattonl > Business : http://home.att.net/~pattonl/digital_resources.htm