import {
    ParameterLookupTable
} from "../../../../engine/graphics/particles/particular/engine/parameter/ParameterLookupTable.js";

/**
 * Values for standard air (15°C, 1 atm, 450 ppm CO₂)
 */
const AIR_REFRACTION_INDEX_LUT = ParameterLookupTable.from(
    2, // number of columns in the table [n, k]
    // RI lookup data (n, k) for standard air across UV to long-wave IR
    [
        // UV (short-wave)
        1.0003280, 0.0, // 200nm
        1.0003070, 0.0, // 250nm
        1.0002930, 0.0, // 300nm
        1.0002850, 0.0, // 350nm
        // Visible baseline (kept from previous table for continuity)
        1.0002801, 0.0, // 400nm
        1.0002785, 0.0, // 450nm
        1.0002773, 0.0, // 500nm
        1.0002765, 0.0, // 550nm
        1.0002759, 0.0, // 600nm
        1.0002755, 0.0, // 650nm
        1.0002751, 0.0, // 700nm
        // Near-IR to long-wave IR
        1.0002747, 0.0, // 800nm
        1.0002740, 0.0, // 900nm
        1.0002734, 0.0, // 1000nm (1µm)
        1.0002720, 0.0, // 1500nm (1.5µm)
        1.0002710, 0.0, // 2000nm (2µm)
        1.0002700, 0.0, // 3000nm (3µm)
        1.0002690, 0.0, // 5000nm (5µm)
        1.0002685, 0.0, // 10000nm (10µm)
        1.0002682, 0.0  // 20000nm (20µm)
    ],
    // lookup positions, in nanometers
    [
        200,
        250,
        300,
        350,
        400,
        450,
        500,
        550,
        600,
        650,
        700,
        800,
        900,
        1000,
        1500,
        2000,
        3000,
        5000,
        10000,
        20000
    ]
)

/**
 * ☁️ AIR (Medium)
 * @param {number[]} result complex number, refraction index
 * @param {number} wavelength_nm in nanometers
 */
export function ri_air(result, wavelength_nm) {
    // can effectively be assumed [1,0] but we're being more precise
    AIR_REFRACTION_INDEX_LUT.sample(wavelength_nm, result);
}