old_contents: #!/usr/bin/env python3
  
  class Triangle:
      """A class structure for storing and minipulating a triangle.
  
      The trianlge is represented as a 3-tuple of points. Each point is
      represented as a 2-tuple of floats, the first element being the
      x-coordinate and the second element being the y-coordinate.
  
      Several useful operations can be applied to a triangle such as, rotate,
      translate, split across altitude, and rectanglify.
      
      The Triangle (and underlying tuple) should be treated as an immutable
      data structure. All methods return a new triangle and do not modify the
      existing one."""
  
      def __init__(self, tpl):
          """tpl is a 3-tuple of coordinates"""
          self.points = tpl
          
  
  class Shape:
      """A class structure for representing and minipulating arbitary shapes.
      
      A shape is defines as a list of triangles (see Triangle). Several
      operations can be applied to a shape such as rotation, translation and
      splitting the shape into two.
  
      This object should be treated as an immutable data structure. All methods
      return new shapes and do not modify the existing one."""
  
      def __init__(self, triangle_list):
          """triangle_list is a list of triangles"""
          self.triangles = triangle_list
  
new_contents: #!/usr/bin/env python3
  
  import math
  
  class Triangle:
      """A class structure for storing and minipulating a triangle.
  
      The trianlge is represented as a 3-tuple of points. Each point is
      represented as a 2-tuple of floats, the first element being the
      x-coordinate and the second element being the y-coordinate.
  
      Several useful operations can be applied to a triangle such as, rotate,
      translate, split across altitude, and rectanglify.
      
      The Triangle (and underlying tuple) should be treated as an immutable
      data structure. All methods return a new triangle and do not modify the
      existing one."""
  
      def __init__(self, tpl):
          """tpl is a 3-tuple of coordinates"""
          self.points = tpl
      
      def rotate(self, pivot, rangle):
          """Return a new triangle rotate clockwise (by angle) around pivot.
          
          pivot -- A coordinate pair
          rangle -- The angle to rotate by in radians"""
          new_points = list()
          px, py = pivot
          for x, y in self.points:
              dx, dy = x - px, y - py
              current_angle = math.atan2(dy, dx)
              total_angle = current_angle + rangle
              r = math.hypot(dx, dy)
              nx = r*math.cos(total_angle) + px
              ny = r*math.sin(total_angle) + py
              new_points.append((nx, ny))
          return Triangle(tuple(new_points))
  
  
  class Shape:
      """A class structure for representing and minipulating arbitary shapes.
      
      A shape is defines as a list of triangles (see Triangle). Several
      operations can be applied to a shape such as rotation, translation and
      splitting the shape into two.
  
      This object should be treated as an immutable data structure. All methods
      return new shapes and do not modify the existing one."""
  
      def __init__(self, triangle_list):
          """triangle_list is a list of triangles"""
          self.triangles = triangle_list
  
subject: Add method to rotate triangle