comparison python/utils.py @ 19:5a21d2cfee44

added polygon plotting
author Nicolas Saunier <nico@confins.net>
date Fri, 27 Nov 2009 19:16:12 -0500
parents 9d6831cfe675
children 6fb59cfb201e
comparison
equal deleted inserted replaced
18:ef35d5f111e4 19:5a21d2cfee44
83 return projected[:2] 83 return projected[:2]
84 84
85 def printPoint(x,y): 85 def printPoint(x,y):
86 return '(%f,%f)'%(x,y) 86 return '(%f,%f)'%(x,y)
87 87
88 def plotPolygon(poly, options = ''):
89 from numpy.core.multiarray import array
90 from matplotlib.pyplot import plot
91 from shapely.geometry import Polygon
92
93 tmp = array(poly.exterior)
94 plot(tmp[:,0], tmp[:,1], options)
95
88 if __name__ == "__main__": 96 if __name__ == "__main__":
89 import doctest 97 import doctest
90 import unittest 98 import unittest
91 #suite = doctest.DocFileSuite('tests/ubc_utils.txt') 99 #suite = doctest.DocFileSuite('tests/ubc_utils.txt')
92 suite = doctest.DocTestSuite() 100 suite = doctest.DocTestSuite()