Skip to content

Commit

Permalink
Correct start height
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoff97 committed Oct 7, 2024
1 parent 58230df commit 02ab350
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions backend-rust/src/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -855,8 +855,8 @@ pub fn prepare_search(
cell_size: f32,
query: SearchQuery,
) -> SearchSetup {
let height_at_point = get_height_at_point(latitude, longitude) as f32;
let height = query
let mut height_at_point = get_height_at_point(latitude, longitude) as f32;
let mut height = query
.start_height
.unwrap_or(height_at_point + query.additional_height)
.max(height_at_point);
Expand All @@ -879,6 +879,11 @@ pub fn prepare_search(
(grid.heights.shape()[0] / 2) as GridIxType,
(grid.heights.shape()[1] / 2) as GridIxType,
);
height_at_point = grid.heights[[start_ix.0 as usize, start_ix.1 as usize]] as f32;
height = query
.start_height
.unwrap_or(height_at_point + query.additional_height)
.max(height_at_point);

let config = SearchConfig {
grid: grid,
Expand Down

0 comments on commit 02ab350

Please sign in to comment.