Fix the conductivity error (was calculating the wrong timestep)
Also, use f64 and force them to be real.
This commit is contained in:
@@ -29,8 +29,8 @@ fn clamp(v: f32, range: f32) -> f32 {
|
||||
v.min(range).max(-range)
|
||||
}
|
||||
|
||||
fn norm_color(v: f32) -> u8 {
|
||||
(v * 64.0 + 128.0).max(0f32).min(255f32) as u8
|
||||
fn norm_color(v: f64) -> u8 {
|
||||
(v * 64.0 + 128.0).max(0.0).min(255.0) as u8
|
||||
}
|
||||
|
||||
fn curl(x: f32, y: f32) -> f32 {
|
||||
@@ -55,7 +55,7 @@ impl ColorTermRenderer {
|
||||
//let g = norm_color(cell.ex());
|
||||
//let b = norm_color(cell.ey());
|
||||
//let g = norm_color(curl(cell.ex(), cell.ey()));
|
||||
let g = norm_color((cell.bz() * 3.0e8) as _);
|
||||
let g = norm_color((cell.bz() * 3.0e8).into());
|
||||
write!(&mut buf, "{}", RGB(r, g, b).paint(square));
|
||||
}
|
||||
write!(&mut buf, "\n");
|
||||
|
Reference in New Issue
Block a user