src/room.js
function _computeReflectionCoefficients(absorptionCoefficients) {
  let reflectionCoefficients = [];
  for (let property in Utils.DEFAULT_REFLECTION_COEFFICIENTS) {
    if (Utils.DEFAULT_REFLECTION_COEFFICIENTS
        .hasOwnProperty(property)) {
      // Compute average absorption coefficient (per wall).
      reflectionCoefficients[property] = 0;
      for (let j = 0; j < Utils.NUMBER_REFLECTION_AVERAGING_BANDS; j++) {
        let bandIndex = j + Utils.ROOM_STARTING_AVERAGING_BAND;
        reflectionCoefficients[property] +=
          absorptionCoefficients[property][bandIndex];
      }
      reflectionCoefficients[property] /=
        Utils.NUMBER_REFLECTION_AVERAGING_BANDS;

      // Convert absorption coefficient to reflection coefficient.
      reflectionCoefficients[property] =
        Math.sqrt(1 - reflectionCoefficients[property]);
    }
  }
  return reflectionCoefficients;
}
function _computeReflectionCoefficients(absorptionCoefficients) {
  let reflectionCoefficients = [];
  for (let property in Utils.DEFAULT_REFLECTION_COEFFICIENTS) {
    if (Utils.DEFAULT_REFLECTION_COEFFICIENTS
        .hasOwnProperty(property)) {
      // Compute average absorption coefficient (per wall).
      reflectionCoefficients[property] = 0;
      for (let j = 0; j < Utils.NUMBER_REFLECTION_AVERAGING_BANDS; j++) {
        let bandIndex = j + Utils.ROOM_STARTING_AVERAGING_BAND;
        reflectionCoefficients[property] +=
          absorptionCoefficients[property][bandIndex];
      }
      reflectionCoefficients[property] /=
        Utils.NUMBER_REFLECTION_AVERAGING_BANDS;

      // Convert absorption coefficient to reflection coefficient.
      reflectionCoefficients[property] =
        Math.sqrt(1 - reflectionCoefficients[property]);
    }
  }
  return reflectionCoefficients;
}
function _computeReflectionCoefficients ( absorptionCoefficients ) { let reflectionCoefficients = [ ] ; for ( let property in Utils . DEFAULT_REFLECTION_COEFFICIENTS ) { if ( Utils . DEFAULT_REFLECTION_COEFFICIENTS . hasOwnProperty ( property ) ) { // Compute average absorption coefficient (per wall). reflectionCoefficients [ property ] = 0 ; for ( let j = 0 ; j < Utils . NUMBER_REFLECTION_AVERAGING_BANDS ; j ++ ) { let bandIndex = j + Utils . ROOM_STARTING_AVERAGING_BAND ; reflectionCoefficients [ property ] += absorptionCoefficients [ property ] [ bandIndex ] ; } reflectionCoefficients [ property ] /= Utils . NUMBER_REFLECTION_AVERAGING_BANDS ; // Convert absorption coefficient to reflection coefficient. reflectionCoefficients [ property ] = Math . sqrt ( 1 - reflectionCoefficients [ property ] ) ; } } return reflectionCoefficients ; }
Compute reflection coefficients from absorption coefficients.
@param {Object} absorptionCoefficients
@return {Object}
Compute reflection coefficients from absorption coefficients .