import { factorial } from "../../../../math/factorial.js";

/**
 * computes K(l,m) normalization constant
 * @see "Deringing Spherical Harmonics" by Peter-Pike Sloan
 * @param {number} l band
 * @param {number} m
 * @returns {number}
 */
export function sh_compute_K(l, m) {

    const a = (2 * l + 1) * factorial(l - Math.abs(m))

    const b = 4 * Math.PI * factorial(l + Math.abs(m))

    return Math.sqrt(a / b);
}