#[derive(Debug, Clone, Copy, PartialEq)]
pub struct LensingShaderData {
pub schwarzschild_radius_m: f64,
pub spin_parameter: f64,
pub inclination_rad: f64,
pub observer_distance_m: f64,
}
impl LensingShaderData {
pub fn sagittarius_a_star() -> Self {
Self {
schwarzschild_radius_m: 1.2e10,
spin_parameter: 0.9,
inclination_rad: std::f64::consts::FRAC_PI_4,
observer_distance_m: 2.55e20,
}
}
pub fn einstein_ring_radius_rad(&self) -> f64 {
(4.0 * 6.674e-11 * 4.15e6 * 1.989e30 / (2.998e8 * 2.998e8 * self.observer_distance_m))
.sqrt()
}
pub fn isco_radius(&self) -> f64 {
let a = self.spin_parameter;
if a.abs() < 1e-12 {
return 3.0 * self.schwarzschild_radius_m;
}
let z1 = 1.0
+ (1.0 - a * a).powf(1.0 / 3.0)
* ((1.0 + a).powf(1.0 / 3.0) + (1.0 - a).powf(1.0 / 3.0));
let z2 = (3.0 * a * a + z1 * z1).sqrt();
let r_g = self.schwarzschild_radius_m / 2.0;
r_g * (3.0 + z2 - ((3.0 - z1) * (3.0 + z1 + 2.0 * z2)).sqrt())
}
pub fn photon_sphere_radius(&self) -> f64 {
1.5 * self.schwarzschild_radius_m
}
pub fn gravitational_redshift(&self, emission_radius_m: f64) -> f64 {
let rs = self.schwarzschild_radius_m;
1.0 / (1.0 - rs / emission_radius_m).sqrt() - 1.0
}
}
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct AccretionDiskShaderData {
pub inner_radius_isco: f32,
pub outer_radius_isco: f32,
pub rotation_speed: f32,
pub turbulence: f32,
}
impl AccretionDiskShaderData {
pub fn standard_thin_disk() -> Self {
Self {
inner_radius_isco: 1.0,
outer_radius_isco: 20.0,
rotation_speed: 1.0,
turbulence: 0.1,
}
}
pub fn thick_advective() -> Self {
Self {
inner_radius_isco: 1.0,
outer_radius_isco: 50.0,
rotation_speed: 0.7,
turbulence: 0.5,
}
}
}