Abstract coordinates behind a Coord type

This will allow adding another dimension to the coordinate, more easily.
This commit is contained in:
2020-09-22 11:23:58 -07:00
parent b96f9c5dcc
commit 6d77c85179
7 changed files with 95 additions and 59 deletions

View File

@@ -125,7 +125,7 @@ impl<'a> RenderSteps<'a> {
let h = self.sim.height();
for y in 0..h {
for x in 0..w {
let cell = self.sim.get(x, y);
let cell = self.sim.get((x, y).into());
let value = measure(cell);
let scaled = if signed {
scale_signed_to_u8(value, typical)
@@ -170,7 +170,7 @@ impl<'a> RenderSteps<'a> {
let yend = (ystart + size).min(h);
for y in ystart..yend {
for x in xstart..xend {
field += measure(self.sim.get(x, y));
field += measure(self.sim.get((x, y).into()));
}
}
let xw = xend - xstart;
@@ -217,12 +217,12 @@ impl Renderer for NumericTermRenderer {
fn render(&mut self, state: &SimSnapshot, _measurements: &[Box<dyn AbstractMeasurement>]) {
for y in 0..state.height() {
for x in 0..state.width() {
let cell = state.get(x, y);
let cell = state.get((x, y).into());
print!(" {:>10.1e}", cell.ex());
}
print!("\n");
for x in 0..state.width() {
let cell = state.get(x, y);
let cell = state.get((x, y).into());
print!("{:>10.1e} {:>10.1e}", cell.ey(), cell.bz());
}
print!("\n");