code: function binarySearchIndices( value ) {
  
  			function binarySearch( start, end ) {
  
  				// return closest larger index
  				// if exact number is not found
  
  				if ( end < start )
  					return start;
  
  				var mid = start + Math.floor( ( end - start ) / 2 );
  
  				if ( cumulativeAreas[ mid ] > value ) {
  
  					return binarySearch( start, mid - 1 );
  
  				} else if ( cumulativeAreas[ mid ] < value ) {
  
  					return binarySearch( mid + 1, end );
  
  				} else {
  
  					return mid;
  
  				}
  
  			}
  
  			var result = binarySearch( 0, cumulativeAreas.length - 1 )
  			return result;
  
  		}
docs: binary search cumulative areas array