     rate: 2
     cx: Canvas.width/2
     
-    constructor: (@xm, @ym)->
+    constructor: () ->
         @photons = []
 
     emit: () ->

        @l2.attr("y2", Ym)

    roofFn: (x) ->
        xm = @xScale.invert(@marker0.attr('cx'))
        ym = @yScale.invert(@marker0.attr('cy'))
        (x<0)*(-0.5+(x+0.5)*(2*ym+1)/(2*xm+1)) + (x>=0)*(ym+(x-xm)*(1-2*ym)/(1-2*xm))

    roofLine: (xFixed, yFixed) ->
        @plot.append("line")

            @photons.push(@emitPhoton()) for [0...@rate]
        @photons = @photons.filter (photon) => photon.visible()
        for photon in @photons
            photon.setCollision()
            photon.move()
            photon.draw()

    emitPhoton: ->
        pos = new Vector @cx + @l*(Math.random()-0.5), 1
        new Sunlight(pos)

class Simulation

