       # Find the first two intersections of the path and the image boundary
       # Create a path and a complement path
       # split into two
+      
+      canvas = document.querySelector('canvas')
+      context = canvas.getContext('2d')
 
-      targetSet.forEach (target) ->
-        
+      targetMap.forEach (intersections, target) ->
+        if intersections.length >= 2
+          beginPathIndex = intersections.unshift()
+          endPathIndex = intersections.unshift()
+
+          i = beginPathIndex
+          while i < endPathIndex
+            line = Line
+              start: path[i]
+              end: path[i+1]
+            drawLine(context, line, "#0F0")
+            i += 1
 
     name: "Cut"
     mousedown: (e) ->
       active = true
-      targetSet = new Set
-      
+      targetMap = new Map
+
       path = [Point localPosition(e, false)]
 
     mousemove: (e) ->

  cut: do ->
    path = []
    active = false
    targetSet = null

    document.addEventListener 'mouseup', () ->
      return unless active

        
        drawLine context, line, "purple"

        targetMap.forEach (intersections, target) ->
          rectLines(target).forEach (targetLine) ->
            intersection = line.intersects(targetLine)

            if intersection
              drawCircle context, intersection

              intersections.push path.length
              path.push intersection

        path.push current

