Popular recipes tagged "point" but not "set"http://code.activestate.com/recipes/tags/point-set/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> Floating point bitwise operations (Python) 2011-11-28T23:47:25-08:00Pyry Pakkanenhttp://code.activestate.com/recipes/users/4180119/http://code.activestate.com/recipes/577967-floating-point-bitwise-operations/ <p style="color: grey"> Python recipe 577967 by <a href="/recipes/users/4180119/">Pyry Pakkanen</a> (<a href="/recipes/tags/bitwise/">bitwise</a>, <a href="/recipes/tags/float/">float</a>, <a href="/recipes/tags/floating/">floating</a>, <a href="/recipes/tags/point/">point</a>). </p> <p>Implements bitwise operations for real numbers by using an infinite one's complement representation.</p> Elegant (?) AoP for methods and functions (Python) 2010-03-02T20:10:38-08:00Alec Thomashttp://code.activestate.com/recipes/users/2870300/http://code.activestate.com/recipes/577082-elegant-aop-for-methods-and-functions/ <p style="color: grey"> Python recipe 577082 by <a href="/recipes/users/2870300/">Alec Thomas</a> (<a href="/recipes/tags/aop/">aop</a>, <a href="/recipes/tags/aspect/">aspect</a>, <a href="/recipes/tags/join/">join</a>, <a href="/recipes/tags/oriented/">oriented</a>, <a href="/recipes/tags/point/">point</a>). Revision 2. </p> <p>There are a couple of other AoP related recipes on ASPN. This one is designed to have a simple, elegant interface.</p> Python Vectors (Python) 2009-11-25T04:50:10-08:00Stephen Chappellhttp://code.activestate.com/recipes/users/2608421/http://code.activestate.com/recipes/576908-python-vectors/ <p style="color: grey"> Python recipe 576908 by <a href="/recipes/users/2608421/">Stephen Chappell</a> (<a href="/recipes/tags/fast/">fast</a>, <a href="/recipes/tags/point/">point</a>, <a href="/recipes/tags/vector/">vector</a>). Revision 3. </p> <p>This recipe implements vectors in pure Python and does not use "C" for speed enhancements. As a result, much effort has gone towards optimizing the instructions for the class methods. There are a few things that have yet to be improved, but it is being posted as an RFC. Comments on the structure, method names, and coding technique are requested for change. Once this code is standardized, work may commence on writing Vector3, Vector4, and VectorX. Please note that there is a difference between the "direction" and "degrees" properties.</p>