def checkPolygons(map): clean = True for edge in map.edgeIter(): l, pa = edge.length(), edge.partialArea() p = Polygon(edge) p.invalidateProperties() if abs(l - p.length()) > 1e-6: print "edge %d: length wrong (was %s, is %s)" % ( edge.label(), l, p.length()) clean = False if abs(pa - p.partialArea()) > 1e-6: print "edge %d: partial area wrong (was %s, is %s)" % ( edge.label(), pa, p.partialArea()) clean = False return clean
def checkPolygons(map): clean = True for edge in map.edgeIter(): l, pa = edge.length(), edge.partialArea() p = Polygon(edge) p.invalidateProperties() if abs(l - p.length()) > 1e-6: print "edge %d: length wrong (was %s, is %s)" % (edge.label(), l, p.length()) clean = False if abs(pa - p.partialArea()) > 1e-6: print "edge %d: partial area wrong (was %s, is %s)" % ( edge.label(), pa, p.partialArea()) clean = False return clean