Board index » delphi » Is a Point in a Polygon?
tr...@circle.net (Trent)
Delphi Developer 
Thu, 29 Jul 1999 03:00:00 GMT

tr...@circle.net (Trent)
Delphi Developer 
Thu, 29 Jul 1999 03:00:00 GMT
Is a Point in a Polygon?I have the vertices of a polgon (up to 100 vertices), and I have a point. What's an easy way to tell if the point is in the polygon? J. Masters 
Christian Ka
Delphi Developer 
Fri, 30 Jul 1999 03:00:00 GMT
Re:Is a Point in a Polygon?See windows api "regions" that should work. QuoteOn Sun, 09 Feb 97 18:41:13 GMT, tr...@circle.net (Trent) wrote: Quote>Software, Projektrealisierung u. Beratung 
Anthony Costanz
Delphi Developer 
Fri, 30 Jul 1999 03:00:00 GMT
Re:Is a Point in a Polygon?QuoteTrent wrote: Joseph O'Rourke's book "Computational Geometry in C". I'm sure if you search the web you will find his algorithm in various forms. Basically what you do is extend a line fron the point and see if it crosses a boundary an even or odd number of times. Tony 
Roger Muss
Delphi Developer 
Mon, 02 Aug 1999 03:00:00 GMT
Re:Is a Point in a Polygon?QuoteIn article <5dl5r8$...@news1alterdial.uu.net> tr...@circle.net (Trent) writes: polygon are intersected by the line. If it's odd, the point is inside the polygon. Roger Musson 
Mark Vaugh
Delphi Developer 
Fri, 06 Aug 1999 03:00:00 GMT
Re:Is a Point in a Polygon?QuoteIn article <5dl5r8$...@news1alterdial.uu.net>, tr...@circle.net (Trent) wrote: ] ]What's an easy way to tell if the point is in the polygon? here's a previous post on the subject by the Lord of Darkness Mark Vaughan  Date[ 06/13/1996 this works for concave and convex polygons. create a polygon by calling allocate_poly_space intercept WM_MouseMove and test x,y coords, the snippet I've put in is what type type { Quote} var i,j : integer; p1_i,p1_j : Point3D; begin j := poly^.numvertices2; result := false; with poly^ do for i:=0 to numvertices2 do begin p1_i := polypoints[i]; p1_j := polypoints[j]; if ((((p1_i.y<=y) and (y<p1_j.y)) or ((p1_j.y<=y) and (y<p1_i.y))) and (x<(p1_j.x  p1_i.x)*(yp1_i.y)/ (p1_j.y  p1_i.y) + p1_i.x)) then result:= not result; j:=i; end; end; function allocate_poly_space(n:integer) : P_poly3D; procedure free_poly_space(var poly:P_Poly3D); { this searches through lists of polygons to find the one the mouse is in procedure TMap_display_form.ZoomboxMouseMove(Sender:TObject; Shift:TShiftState; // ignore this // this is the important bit if // draw the highlighted polygon etc etc etc this may be a little confusing but all you need to do is end; Hope this helps John B 
1. Determine if a point is in a polygon
2. Large Polygon 65k points limit in Win32?
3. is point inside the polygon
4. Detecting whether a point lies within a polygon
5. Finding the polygon that sorrounds a given point.
6. Point in Polygon WINDING without GDI
7. Point in polygon = place in country
8. URGENT: determine if point is within polygon
9. Determinate if a point is in a polygon (Without the Windows API)