use bland::{gamma_from_z, Figure, SmithGridOpts, Stroke};
fn main() {
let n = 60;
let mut grs = Vec::with_capacity(n);
let mut gis = Vec::with_capacity(n);
for i in 0..n {
let f = i as f64 / (n - 1) as f64;
let r = 0.4 + 1.6 * f;
let x = -1.5 + 3.0 * f;
let (gr, gi) = gamma_from_z(r, x);
grs.push(gr);
gis.push(gi);
}
let fig = Figure::smith()
.title("Sāā sweep")
.smith_grid(SmithGridOpts::default())
.line(&grs, &gis, |s| s.label("Ī(f)").stroke(Stroke::Solid))
.legend_bottom_right();
std::fs::create_dir_all("out").expect("create out/");
std::fs::write("out/smith.svg", fig.to_svg()).expect("write svg");
println!("wrote out/smith.svg");
}