parameters: (self, p)
docstring: Sort polygons.
docstring_summary: Sort polygons.
docstring_tokens: Sort polygons .
function: def sort_poly(self, p):
          """
          Sort polygons.
          """
          min_axis = np.argmin(np.sum(p, axis=1))
          p = p[[min_axis, (min_axis + 1) % 4,\
              (min_axis + 2) % 4, (min_axis + 3) % 4]]
          if abs(p[0, 0] - p[1, 0]) > abs(p[0, 1] - p[1, 1]):
              return p
          else:
              return p[[0, 3, 2, 1]]
function_tokens: def sort_poly ( self , p ) : min_axis = np . argmin ( np . sum ( p , axis = 1 ) ) p = p [ [ min_axis , ( min_axis + 1 ) % 4 , ( min_axis + 2 ) % 4 , ( min_axis + 3 ) % 4 ] ] if abs ( p [ 0 , 0 ] - p [ 1 , 0 ] ) > abs ( p [ 0 , 1 ] - p [ 1 , 1 ] ) : return p else : return p [ [ 0 , 3 , 2 , 1 ] ]