#NEWLINE# def draw_grid( env , f , mins , maxes , xres = 0.1 , yres = 0.1 , zres = 0.04 , color = ( 1 , 1 , 0 , 1 ) ) : #NEWLINE# #INDENT# ( xmin , ymin , zmin ) = mins #NEWLINE# ( xmax , ymax , zmax ) = maxes #NEWLINE# nfine = 30 #NEWLINE# xcoarse = np . arange ( xmin , xmax , xres ) #NEWLINE# xmax = xcoarse [ ( - 1 ) ] #NEWLINE# ycoarse = np . arange ( ymin , ymax , yres ) #NEWLINE# ymax = ycoarse [ ( - 1 ) ] #NEWLINE# if ( zres == ( - 1 ) ) : #NEWLINE# #INDENT# zcoarse = [ ( ( zmin + zmax ) / 2.0 ) ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# zcoarse = np . arange ( zmin , zmax , zres ) #NEWLINE# zmax = zcoarse [ ( - 1 ) ] #NEWLINE# #UNINDENT# xfine = np . linspace ( xmin , xmax , nfine ) #NEWLINE# yfine = np . linspace ( ymin , ymax , nfine ) #NEWLINE# zfine = np . linspace ( zmin , zmax , nfine ) #NEWLINE# lines = [ ] #NEWLINE# if ( len ( zcoarse ) > 1 ) : #NEWLINE# #INDENT# for x in y : #NEWLINE# #INDENT# for y in ycoarse : #NEWLINE# #INDENT# xyz = np . zeros ( ( nfine , 3 ) ) #NEWLINE# xyz [ : , 0 ] = x #NEWLINE# xyz [ : , 1 ] = y #NEWLINE# xyz [ : , 2 ] = zfine #NEWLINE# lines . append ( f ( xyz ) ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for y in ycoarse : #NEWLINE# #INDENT# for z in zcoarse : #NEWLINE# #INDENT# xyz = np . zeros ( ( nfine , 3 ) ) #NEWLINE# xyz [ : , 0 ] = xfine #NEWLINE# xyz [ : , 1 ] = y #NEWLINE# xyz [ : , 2 ] = z #NEWLINE# lines . append ( f ( xyz ) ) #NEWLINE# #UNINDENT# #UNINDENT# for z in zcoarse : #NEWLINE# #INDENT# for x in xcoarse : #NEWLINE# #INDENT# xyz = np . zeros ( ( nfine , 3 ) ) #NEWLINE# xyz [ : , 0 ] = x #NEWLINE# xyz [ : , 1 ] = yfine #NEWLINE# xyz [ : , 2 ] = z #NEWLINE# lines . append ( f ( xyz ) ) #NEWLINE# #UNINDENT# #UNINDENT# handles = [ ] #NEWLINE# for line in lines : #NEWLINE# #INDENT# handles . append ( env . drawlinestrip ( line , 1 , color ) ) #NEWLINE# #UNINDENT# return handles