use crate::config::parameters::{AU, PI};
pub fn dust_tail_angle(beta: f64, r_au: f64) -> f64 {
let radial_accel = beta * 5.93e-3 / (r_au * r_au);
let v_orbit = 29784.0 / r_au.sqrt();
if v_orbit < 1.0 {
return 0.0;
}
(radial_accel / v_orbit).atan()
}
pub fn ion_tail_aberration(r_au: f64, solar_wind_velocity: f64) -> f64 {
let v_orbit = 29784.0 / r_au.max(0.01).sqrt();
(v_orbit / solar_wind_velocity.max(1.0)).atan()
}
pub fn striae_spacing(ejection_velocity: f64, time_interval_s: f64) -> f64 {
ejection_velocity * time_interval_s
}
pub fn apparent_tail_length_deg(physical_length_m: f64, delta_au: f64) -> f64 {
let d = delta_au * AU;
if d < 1.0 {
return 0.0;
}
(physical_length_m / d).atan().to_degrees()
}
pub fn tail_surface_brightness(afrho_cm: f64, r_au: f64, delta_au: f64) -> f64 {
let denom = r_au * r_au * delta_au * delta_au;
if denom < 1.0e-10 {
return 0.0;
}
afrho_cm / denom
}
pub fn disconnection_probability(solar_wind_velocity: f64, gas_production_q: f64) -> f64 {
let sw_factor: f64 = if solar_wind_velocity > 600_000.0 {
0.5
} else {
0.1
};
let q_factor: f64 = if gas_production_q > 1.0e28 { 0.3 } else { 0.1 };
(sw_factor + q_factor).min(1.0)
}
pub fn anti_tail_angle(comet_inclination_deg: f64, earth_lat_from_plane_deg: f64) -> f64 {
let i_rad = comet_inclination_deg.to_radians();
let lat_rad = earth_lat_from_plane_deg.to_radians();
let projected = i_rad.sin() * lat_rad.cos();
projected.abs().asin()
}
pub fn jet_feature_extent(jet_velocity: f64, expansion_velocity: f64) -> f64 {
if expansion_velocity < 1.0 {
return PI / 2.0;
}
(jet_velocity / expansion_velocity).atan()
}