parameters: (x1, y1, x2, y2)
return_statement: return co_ords if abs(delX) > abs(delY) else co_ords[::-1]
docstring: Calculate the co-ordinates for Bresehnam lines
          bresenham(x1, y1, x2, y2)
          returns a list of tuple of points
docstring_summary: Calculate the co-ordinates for Bresehnam lines
          bresenham(x1, y1, x2, y2)
          returns a list of tuple of points
docstring_tokens: Calculate the co - ordinates for Bresehnam lines bresenham ( x1 y1 x2 y2 ) returns a list of tuple of points
function: def bresenham(x1, y1, x2, y2):
      '''
          Calculate the co-ordinates for Bresehnam lines
          bresenham(x1, y1, x2, y2)
          returns a list of tuple of points
      '''
      swap = False
      
      # Calculate delta for x and y
      delX, delY = calc_del(x1, x2, y1, y2)
  
      # Swap x and y if y > x
      if abs(delY) > abs(delX):
          x1, y1 = y1, x1
          x2, y2 = y2, x2
      
      # Swap x and y co-ordinates if x1 > x2
      if x1 > x2:
          swap = True
          x1, x2 = x2, x1
          y1, y2 = y2, y1
  
      # Recalculate delta for x and y
      delX, delY = calc_del(x1, x2, y1, y2)
  
      # calculate step and error
      step = 1 if y1 < y2 else -1
      error = int(delX/2.0)
  
      y = y1
      co_ords = []
  
      # Calculate co-ordinates for the bresenham line
      for x in range(x1, x2 + 1):
          point = (x, y) if abs(delX) > abs(delY) else (y, x)
          error -= abs(delY)
          if error < 0:
              y += step
              error += delX
          co_ords.append(point)
  
      return co_ords if abs(delX) > abs(delY) else co_ords[::-1]
function_tokens: def bresenham ( x1 , y1 , x2 , y2 ) : swap = False # Calculate delta for x and y delX , delY = calc_del ( x1 , x2 , y1 , y2 ) # Swap x and y if y > x if abs ( delY ) > abs ( delX ) : x1 , y1 = y1 , x1 x2 , y2 = y2 , x2 # Swap x and y co-ordinates if x1 > x2 if x1 > x2 : swap = True x1 , x2 = x2 , x1 y1 , y2 = y2 , y1 # Recalculate delta for x and y delX , delY = calc_del ( x1 , x2 , y1 , y2 ) # calculate step and error step = 1 if y1 < y2 else - 1 error = int ( delX / 2.0 ) y = y1 co_ords = [ ] # Calculate co-ordinates for the bresenham line for x in range ( x1 , x2 + 1 ) : point = ( x , y ) if abs ( delX ) > abs ( delY ) else ( y , x ) error -= abs ( delY ) if error < 0 : y += step error += delX co_ords . append ( point ) return co_ords if abs ( delX ) > abs ( delY ) else co_ords [ : : - 1 ]