Top-rated recipes tagged "polygon"http://code.activestate.com/recipes/tags/polygon/top/2014-04-24T18:13:34-07:00ActiveState Code RecipesA point-in-polygon program (S.W. Sloan algorithm) (Python) 2014-04-24T18:13:34-07:00PGhttp://code.activestate.com/recipes/users/4184598/http://code.activestate.com/recipes/578381-a-point-in-polygon-program-sw-sloan-algorithm/ <p style="color: grey"> Python recipe 578381 by <a href="/recipes/users/4184598/">PG</a> (<a href="/recipes/tags/point/">point</a>, <a href="/recipes/tags/polygon/">polygon</a>). Revision 2. </p> <p>Class to compute if a point(s) lies inside/outside/on-side of a polygon.</p> <p>UPDATE: The class now works with sequences of points.</p> <p>This is a Python 3 implementation of the Sloan's improved version (FORTRAN 77 code) of the Nordbeck and Rystedt algorithm, published in the paper:</p> <p>SLOAN, S.W. (1985): A point-in-polygon program. Adv. Eng. Software, Vol 7, No. 1, pp 45-47.</p> <p>This class has 1 public method (is_inside) that returns the minimum distance to the nearest point of the polygon:</p> <p>If is_inside &lt; 0 then point is outside the polygon. If is_inside = 0 then point in on a side of the polygon. If is_inside &gt; 0 then point is inside the polygon.</p> 2D polygon area (Python) 2012-10-01T16:22:13-07:00Jamie Bullhttp://code.activestate.com/recipes/users/4183059/http://code.activestate.com/recipes/578275-2d-polygon-area/ <p style="color: grey"> Python recipe 578275 by <a href="/recipes/users/4183059/">Jamie Bull</a> (<a href="/recipes/tags/2d/">2d</a>, <a href="/recipes/tags/area/">area</a>, <a href="/recipes/tags/geometry/">geometry</a>, <a href="/recipes/tags/polygon/">polygon</a>). </p> <p>Function for finding the area of a polygon in a 2D co-ordinate system.</p> 3D polygon area (Python) 2012-10-01T16:29:26-07:00Jamie Bullhttp://code.activestate.com/recipes/users/4183059/http://code.activestate.com/recipes/578276-3d-polygon-area/ <p style="color: grey"> Python recipe 578276 by <a href="/recipes/users/4183059/">Jamie Bull</a> (<a href="/recipes/tags/3d/">3d</a>, <a href="/recipes/tags/area/">area</a>, <a href="/recipes/tags/geometry/">geometry</a>, <a href="/recipes/tags/polygon/">polygon</a>). </p> <p>Function for finding the area of a polygon in a 3D co-ordinate system.</p>