       start: currentPoint
       end: nextPoint
 
-drawLine = (context, line, color="#8BF") ->
+drawLine = (context, line, color="#8BF", transform=Matrix.IDENTITY) ->
+  p1 = transform.transformPoint(line.start)
+  p2 = transform.transformPoint(line.end)
+
   context.beginPath()
-  context.moveTo(line.start.x, line.start.y)
-  context.lineTo(line.end.x, line.end.y)
+  context.moveTo(p1.x, p1.y)
+  context.lineTo(p2.x, p2.y)
   context.lineWidth = 2
   context.strokeStyle = color
   context.stroke()
 
-drawRect = (context, target) ->
+drawRect = (context, target, transform=Matrix.IDENTITY) ->
   rectLines(target)
   .forEach (line) ->
-    drawLine context, line
+    drawLine context, line, null, transform
 
 angleBetween = (a, b, origin=Point.ZERO) ->
   Point.direction(origin, b) - Point.direction(origin, a)

          unless targetMap.has target
            targetMap.set target, []

            drawRect(context, target)

        prev = path[path.length - 1]
        current = Point localPosition(e, false)

        line = Line
          start: prev
          end: current

        drawLine context, line, "purple"

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

            if intersection
              drawCircle context, intersection

              intersections.push [path.length, i]
              path.push intersection


  target.matrix.transformPoint(Point(width/2, height/2))

drawCircle = (context, p, transform=Matrix.IDENTITY) ->
  p = transform.transformPoint(p)
  context.beginPath()
  context.arc(p.x, p.y, 5, 0, 2*Math.PI)
  context.fillStyle = "magenta"
