36 lines
1.2 KiB
Rust
36 lines
1.2 KiB
Rust
use coremem::{mat, GenericSim, SampleableSim as _, Driver};
|
|
use coremem::geom::{Coord as _, Cube, Index};
|
|
use coremem::real::{Real as _, R32};
|
|
|
|
fn main() {
|
|
coremem::init_logging();
|
|
let width = 401;
|
|
let height = 401;
|
|
let size = Index((width, height, 1).into());
|
|
let feat_size = 1e-6;
|
|
let mut driver: Driver = Driver::new(size, feat_size);
|
|
|
|
let _ = std::fs::create_dir_all("out/examples/em_reflection");
|
|
driver.add_y4m_renderer("out/examples/em_reflection/rendered.y4m", 1, None);
|
|
driver.add_term_renderer(4, None);
|
|
|
|
let reflector = Cube::new(
|
|
Index::new(0, 0, 0).to_meters(feat_size), Index::new(width/10, height, 1).to_meters(feat_size)
|
|
);
|
|
driver.fill_region(&reflector, mat::IsomorphicConductor::new(200f32.cast::<R32>()));
|
|
|
|
loop {
|
|
let imp = if driver.state.step_no() < 50 {
|
|
1e5 * ((driver.state.step_no() as f64)*0.04*std::f64::consts::PI).sin()
|
|
} else {
|
|
0.0
|
|
};
|
|
for y in height/4..height*3/4 {
|
|
let loc = Index((200, y, 0).into());
|
|
driver.state.impulse_ex(loc, imp as _);
|
|
driver.state.impulse_hz(loc, (imp/376.730) as _);
|
|
}
|
|
driver.step();
|
|
}
|
|
}
|