Skip to content

Commit

Permalink
Fix bug in projection
Browse files Browse the repository at this point in the history
  • Loading branch information
mpiannucci committed Jul 25, 2023
1 parent 89c4698 commit 8ed04c4
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/utils/iter/projection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ impl RegularCoordinateIterator {
Self {
start,
step,
end: start + step * count as f64,
end: start + (step * (count - 1) as f64),
current_index: 0,
count,
}
Expand Down Expand Up @@ -212,4 +212,15 @@ mod tests {
assert_eq!(lats.len(), 10);
assert_eq!(lngs.len(), 5);
}

#[test]
fn test_start_end_regular_grid() {
let start = 0.0;
let step = 0.25;
let end = 359.75;
let count = 1440;

let iter = super::RegularCoordinateIterator::new(start, step, count);
assert!((iter.end - end).abs() < f64::EPSILON);
}
}

0 comments on commit 8ed04c4

Please sign in to comment.