use nalgebra::{Complex, Matrix2, Vector2};
pub fn refl(
n1: Complex<f32>,
n2: Complex<f32>,
theta_i: f32,
theta_t: f32,
) -> Matrix2<Complex<f32>> {
let cti = theta_i.cos();
let ctt = theta_t.cos();
let f11 = (n2 * cti - n1 * ctt) / (n1 * ctt + n2 * cti);
let f22 = (n1 * cti - n2 * ctt) / (n1 * cti + n2 * ctt);
Matrix2::from_diagonal(&Vector2::new(f11, f22))
}
pub fn refr(
n1: Complex<f32>,
n2: Complex<f32>,
theta_i: f32,
theta_t: f32,
) -> Matrix2<Complex<f32>> {
let cti = theta_i.cos();
let ctt = theta_t.cos();
let f11 = (2.0 * n1 * cti) / (n1 * ctt + n2 * cti);
let f22 = (2.0 * n1 * cti) / (n1 * cti + n2 * ctt);
Matrix2::from_diagonal(&Vector2::new(f11, f22))
}