def transform(w, h, xmin, ymin, xmax, ymax):
 (xspan, yspan) = ((xmax - xmin), (ymax - ymin))
 xm = (w / xspan)
 ym = (h / yspan)
 xb = (w - (xm * xmax))
 yb = (h - (ym * ymax))
 return (lambda x, y: (int(((xm * x) + xb)), int(((ym * y) + yb))))

def transform ( w , h , xmin , ymin , xmax , ymax ) : ( xspan , yspan ) = ( ( xmax - xmin ) , ( ymax - ymin ) ) xm = ( w / xspan ) ym = ( h / yspan ) xb = ( w - ( xm * xmax ) ) yb = ( h - ( ym * ymax ) ) return ( lambda x , y : ( int ( ( ( xm * x ) + xb ) ) , int ( ( ( ym * y ) + yb ) ) ) )
apply a function to every coordinate in a geometry .