broken: expand to two dimensions.
Broken because there seems to be a scaling issue, and also the previous 1d simulation has no effect when ported to this new 2d world.
This commit is contained in:
@@ -6,13 +6,17 @@ pub struct NumericTermRenderer;
|
||||
|
||||
impl NumericTermRenderer {
|
||||
pub fn render(&self, state: &SimState) {
|
||||
print!("B: ");
|
||||
for cell in state.cells() {
|
||||
print!("{:>10.1e} ", cell.by());
|
||||
}
|
||||
print!("\nE:");
|
||||
for cell in state.cells() {
|
||||
print!("{:>10.1e} ", cell.ez());
|
||||
for y in 0..state.height() {
|
||||
for x in 0..state.width() {
|
||||
let cell = state.get(x, y);
|
||||
print!(" {:>10.1e}", cell.ex());
|
||||
}
|
||||
print!("\n");
|
||||
for x in 0..state.width() {
|
||||
let cell = state.get(x, y);
|
||||
print!("{:>10.1e} {:>10.1e}", cell.ey(), cell.bz());
|
||||
}
|
||||
print!("\n");
|
||||
}
|
||||
print!("\n");
|
||||
}
|
||||
@@ -26,14 +30,15 @@ fn clamp(v: f32, range: f32) -> f32 {
|
||||
|
||||
impl ColorTermRenderer {
|
||||
pub fn render(&self, state: &SimState) {
|
||||
let square = "█";
|
||||
for cell in state.cells() {
|
||||
let b_value = clamp(cell.by() * consts::C * 128.0, 255.0);
|
||||
let b_color = RGB(0, b_value.max(0.0) as _, b_value.abs() as _);
|
||||
let e_value = clamp(cell.ez() * 128.0, 255.0);
|
||||
let e_color = RGB(e_value.abs() as _, e_value.max(0.0) as _, 0);
|
||||
print!("{}{}", e_color.paint(square), b_color.paint(square));
|
||||
}
|
||||
print!("\n");
|
||||
unimplemented!()
|
||||
// let square = "█";
|
||||
// for cell in state.cells() {
|
||||
// let b_value = clamp(cell.by() * consts::C * 128.0, 255.0);
|
||||
// let b_color = RGB(0, b_value.max(0.0) as _, b_value.abs() as _);
|
||||
// let e_value = clamp(cell.ez() * 128.0, 255.0);
|
||||
// let e_color = RGB(e_value.abs() as _, e_value.max(0.0) as _, 0);
|
||||
// print!("{}{}", e_color.paint(square), b_color.paint(square));
|
||||
// }
|
||||
// print!("\n");
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user