function getSmoothClampedResolution(resolution, maxResolution, minResolution) {
  let result = Math.min(resolution, maxResolution);
  const ratio = 50;

  result *= Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio + 1;
  if (minResolution) {
    result = Math.max(result, minResolution);
    result /= Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) / ratio + 1;
  }
  return clamp(result, minResolution / 2, maxResolution * 2);
}
function getSmoothClampedResolution(resolution, maxResolution, minResolution) {
  let result = Math.min(resolution, maxResolution);
  const ratio = 50;

  result *= Math.log(1 + ratio * Math.max(0, resolution / maxResolution - 1)) / ratio + 1;
  if (minResolution) {
    result = Math.max(result, minResolution);
    result /= Math.log(1 + ratio * Math.max(0, minResolution / resolution - 1)) / ratio + 1;
  }
  return clamp(result, minResolution / 2, maxResolution * 2);
}
function getSmoothClampedResolution ( resolution , maxResolution , minResolution ) { let result = Math . min ( resolution , maxResolution ) ; const ratio = 50 ; result *= Math . log ( 1 + ratio * Math . max ( 0 , resolution / maxResolution - 1 ) ) / ratio + 1 ; if ( minResolution ) { result = Math . max ( result , minResolution ) ; result /= Math . log ( 1 + ratio * Math . max ( 0 , minResolution / resolution - 1 ) ) / ratio + 1 ; } return clamp ( result , minResolution / 2 , maxResolution * 2 ) ; }
Returns a modified resolution to be between maxResolution and minResolution while
still allowing the value to be slightly out of bounds.
Note: the computation is based on the logarithm function (ln):
- at 1, ln(x) is 0
- above 1, ln(x) keeps increasing but at a much slower pace than x
The final result is clamped to prevent getting too far away from bounds.
@param {number} resolution Resolution.
@param {number} maxResolution Max resolution.
@param {number} minResolution Min resolution.
@return {number} Smoothed resolution.
Returns a modified resolution to be between maxResolution and minResolution while still allowing the value to be slightly out of bounds . Note : the computation is based on the logarithm function ( ln ) : - at 1 ln ( x ) is 0 - above 1 ln ( x ) keeps increasing but at a much slower pace than x The final result is clamped to prevent getting too far away from bounds .
Returns the smooth clamped resolution