docs: function select(segments, selection, buildLog){
  	var result = [];
  	segments.forEach(function(seg){
  		var index =
  			(seg.myFill.above ? 8 : 0) +
  			(seg.myFill.below ? 4 : 0) +
  			((seg.otherFill && seg.otherFill.above) ? 2 : 0) +
  			((seg.otherFill && seg.otherFill.below) ? 1 : 0);
  		if (selection[index] !== 0){
  			// copy the segment to the results, while also calculating the fill status
  			result.push({
  				id: buildLog ? buildLog.segmentId() : -1,
  				start: seg.start,
  				end: seg.end,
  				myFill: {
  					above: selection[index] === 1, // 1 if filled above
  					below: selection[index] === 2  // 2 if filled below
  				},
  				otherFill: null
  			});
  		}
  	});
  
  	if (buildLog)
  		buildLog.selected(result);
  
  	return result;
  }