tiby312 / broccoli-project

MIT License
79 stars 2 forks source link

Knearest panics #170

Closed WaDelma closed 2 years ago

WaDelma commented 3 years ago

I was trying to use k_nearest (copy pasted version of k_nearest_mut with references swapped) and my game started to panic with errors that seemed to be caused by overflow (was running the game in release mode). I swapped to k_nearest_mut and had same issue.

I then printed the result of get_elements and the point I was trying to find nearest for, transformed result to code form (using bbox and rect) and made test into broccoli code base which was still failing. Curiously it didn't fail if I used default_rect_knearest.

I then reduced the test from 6132 bbox:es to only 2 and that reduced test is now this PR.

WaDelma commented 3 years ago

As a aside I wont be able to actually use k_nearest or k_nearest_mut in the game as I want to find closest satisfying certain predicate (the task is to find closest certain type of entity).

tiby312 commented 2 years ago

@WaDelma I think I fixed this. Thank you for looking into this! Sorry for the late response. I somehow missed this.