ortho.js
function takeCurve(pred) {
    for(var i=0, n=horizon.length; i<n; ++i) {
      var c = horizon[i]
      if(pred(c)) {
        horizon[i] = horizon[n-1]
        horizon.pop()
        return c
      }
    }
    return null
  }
function takeCurve(pred) {
    for(var i=0, n=horizon.length; i<n; ++i) {
      var c = horizon[i]
      if(pred(c)) {
        horizon[i] = horizon[n-1]
        horizon.pop()
        return c
      }
    }
    return null
  }
function takeCurve ( pred ) { for ( var i = 0 , n = horizon . length ; i < n ; ++ i ) { var c = horizon [ i ] if ( pred ( c ) ) { horizon [ i ] = horizon [ n - 1 ] horizon . pop ( ) return c } } return null }
Finds and remove the first curve in horizon matching predicate
Finds and remove the first curve in horizon matching predicate