original_docstring: Takes this square and another square and returns a bigger square of
      equal area.
docstring: Takes this square and another square and returns a bigger square of
  equal area.
docstring_tokens: Takes this square and another square and returns a bigger square of equal area .
code: def merge_squares(self, square):
      """Takes this square and another square and returns a bigger square of
      equal area."""
      # Make sure it's a square
      s1, s2 = self.orientate(), square.orientate()
      yield Shape(s1.triangles + s2.triangles)
  
      assert float_eq(s1.height().length(), s1.width().length())
      assert float_eq(s2.height().length(), s2.width().length())
  
      tmp = s1 if s1.height().length() > s2.height().length() else s2
      s2 = s2 if s1.height().length() > s2.height().length() else s1
      s1 = tmp
  
      right_most = sorted(s1.convex_hull(), key=cmp_to_key(point_cmp))[3]
      left_most =  sorted(s2.convex_hull(), key=cmp_to_key(point_cmp))[1]
  
      t = (right_most[0] - left_most[0], right_most[1] - left_most[1])
      s2 = s2.translate(t)
      yield Shape(s1.triangles + s2.triangles)
  
      a1, b1, c1, d1 = sorted(s1.convex_hull(), key=cmp_to_key(point_cmp))
      a2, b2, c2, d2 = sorted(s2.convex_hull(), key=cmp_to_key(point_cmp))
      l1 = s1.height().length()
      l2 = s2.height().length()
      cut_point = (b1[0] + l2, b1[1])
      cut1 = LineSegment(a1, cut_point).to_line()
      cut2 = LineSegment(c2, cut_point).to_line()
      combined = Shape(s1.triangles + s2.triangles)
      ns1, ns2 = combined.split(cut1)
  
      if len(ns1.convex_hull()) == 3:
          triangle = ns1
          rest = ns2
      elif len(ns2.convex_hull()) == 3:
          triangle = ns2
          rest = ns1
      else:
          raise Exception("Bad cut" + str(ns1.convex_hull()) + str(ns2.convex_hull()))
      
      yield Shape(triangle.triangles + rest.triangles)
  
      triangle = triangle.rotate(a1, math.pi / 2)
      combined = Shape(triangle.triangles + rest.triangles)
      yield(combined)
  
      ns1, ns2 = combined.split(cut2)
  
      if len(ns1.convex_hull()) == 3:
          triangle = ns1
          rest = ns2
      elif len(ns2.convex_hull()) == 3:
          triangle = ns2
          rest = ns1
      else:
          raise Exception("Bad cut" + str(ns1.convex_hull()) + str(ns2.convex_hull()))
  
      yield Shape(triangle.triangles + rest.triangles)
      
      triangle = triangle.rotate(c2, math.pi / 2 * 3)
      combined = Shape(triangle.triangles + rest.triangles)
      yield combined
code_tokens: def merge_squares ( self , square ) : s1 , s2 = self . orientate ( ) , square . orientate ( ) yield Shape ( s1 . triangles + s2 . triangles ) assert float_eq ( s1 . height ( ) . length ( ) , s1 . width ( ) . length ( ) ) assert float_eq ( s2 . height ( ) . length ( ) , s2 . width ( ) . length ( ) ) tmp = s1 if s1 . height ( ) . length ( ) > s2 . height ( ) . length ( ) else s2 s2 = s2 if s1 . height ( ) . length ( ) > s2 . height ( ) . length ( ) else s1 s1 = tmp right_most = sorted ( s1 . convex_hull ( ) , key = cmp_to_key ( point_cmp ) ) [ 3 ] left_most = sorted ( s2 . convex_hull ( ) , key = cmp_to_key ( point_cmp ) ) [ 1 ] t = ( right_most [ 0 ] - left_most [ 0 ] , right_most [ 1 ] - left_most [ 1 ] ) s2 = s2 . translate ( t ) yield Shape ( s1 . triangles + s2 . triangles ) a1 , b1 , c1 , d1 = sorted ( s1 . convex_hull ( ) , key = cmp_to_key ( point_cmp ) ) a2 , b2 , c2 , d2 = sorted ( s2 . convex_hull ( ) , key = cmp_to_key ( point_cmp ) ) l1 = s1 . height ( ) . length ( ) l2 = s2 . height ( ) . length ( ) cut_point = ( b1 [ 0 ] + l2 , b1 [ 1 ] ) cut1 = LineSegment ( a1 , cut_point ) . to_line ( ) cut2 = LineSegment ( c2 , cut_point ) . to_line ( ) combined = Shape ( s1 . triangles + s2 . triangles ) ns1 , ns2 = combined . split ( cut1 ) if len ( ns1 . convex_hull ( ) ) == 3 : triangle = ns1 rest = ns2 elif len ( ns2 . convex_hull ( ) ) == 3 : triangle = ns2 rest = ns1 else : raise Exception ( "Bad cut" + str ( ns1 . convex_hull ( ) ) + str ( ns2 . convex_hull ( ) ) ) yield Shape ( triangle . triangles + rest . triangles ) triangle = triangle . rotate ( a1 , math . pi / 2 ) combined = Shape ( triangle . triangles + rest . triangles ) yield ( combined ) ns1 , ns2 = combined . split ( cut2 ) if len ( ns1 . convex_hull ( ) ) == 3 : triangle = ns1 rest = ns2 elif len ( ns2 . convex_hull ( ) ) == 3 : triangle = ns2 rest = ns1 else : raise Exception ( "Bad cut" + str ( ns1 . convex_hull ( ) ) + str ( ns2 . convex_hull ( ) ) ) yield Shape ( triangle . triangles + rest . triangles ) triangle = triangle . rotate ( c2 , math . pi / 2 * 3 ) combined = Shape ( triangle . triangles + rest . triangles ) yield combined
short_docstring: Takes this square and another square and returns a bigger square of
  equal area.
short_docstring_tokens: Takes this square and another square and returns a bigger square of equal area .
comment: """Takes this square and another square and returns a bigger square of
      equal area."""$SEP$# Make sure it's a square