def _euler_step(xf_traj, yf_traj, dmap, f):
 (ny, nx) = dmap.grid.shape
 xi = xf_traj[(-1)]
 yi = yf_traj[(-1)]
 (cx, cy) = f(xi, yi)
 if (cx == 0):
  dsx = np.inf
 elif (cx < 0):
  dsx = (xi / (- cx))
 else:
  dsx = (((nx - 1) - xi) / cx)
 if (cy == 0):
  dsy = np.inf
 elif (cy < 0):
  dsy = (yi / (- cy))
 else:
  dsy = (((ny - 1) - yi) / cy)
 ds = min(dsx, dsy)
 xf_traj.append((xi + (cx * ds)))
 yf_traj.append((yi + (cy * ds)))
 return (ds, xf_traj, yf_traj)

def _euler_step ( xf_traj , yf_traj , dmap , f ) : ( ny , nx ) = dmap . grid . shape xi = xf_traj [ ( - 1 ) ] yi = yf_traj [ ( - 1 ) ] ( cx , cy ) = f ( xi , yi ) if ( cx == 0 ) : dsx = np . inf elif ( cx < 0 ) : dsx = ( xi / ( - cx ) ) else : dsx = ( ( ( nx - 1 ) - xi ) / cx ) if ( cy == 0 ) : dsy = np . inf elif ( cy < 0 ) : dsy = ( yi / ( - cy ) ) else : dsy = ( ( ( ny - 1 ) - yi ) / cy ) ds = min ( dsx , dsy ) xf_traj . append ( ( xi + ( cx * ds ) ) ) yf_traj . append ( ( yi + ( cy * ds ) ) ) return ( ds , xf_traj , yf_traj )
simple euler integration step that extends streamline to boundary .