Ray-casting algorithm: Difference between revisions

→‎{{header|Python}}: scroll regions to reduce length
(Add Python)
(→‎{{header|Python}}: scroll regions to reduce length)
Line 366:
 
=={{header|Python}}==
<div style="height:70ex;overflow:scroll"><lang python>from collections import namedtuple
from pprint import pprint as pp
import sys
Line 468:
print ' ', '\t'.join("%s: %s" % (p, ispointinside(p, poly))
for p in testpoints[6:])
</lang></div>
 
'''Sample output'''
<pre style="height:30ex;overflow:scroll">
<pre>
TESTING WHETHER POINTS ARE WITHIN POLYGONS
 
Line 524:
 
'''Helper routine to convert Fortran Polygons and points to Python'''
<div style="height:30ex;overflow:scroll">
<lang python>def _convert_fortran_shapes():
point = Pt
Line 550 ⟶ 551:
print ' ', ',\n '.join(str(e) for e in p.edges) + '\n )),'
print ' ]'
_convert_fortran_shapes()</lang></div>
 
=={{header|Smalltalk}}==
Anonymous user