bevy-spatial icon indicating copy to clipboard operation
bevy-spatial copied to clipboard

Entities in rectangular region

Open Temak1 opened this issue 3 years ago • 3 comments

Hello! This crate is what I was looking for! Although, I'm missing one feature: I need be able to pick all entities in rectangular region. Could you please help me with that?

Temak1 avatar Dec 03 '22 14:12 Temak1

that's currently not supported by the crate itself, tho one of the underlying trees might support it in some way.

I'll have to take a look at how feasible it is to implement.

laundmo avatar Dec 03 '22 17:12 laundmo

Hello! I am also interested in a rectangular region feature. I looked into kd-tree code and found that it supports lookups in an axis-aligned rectangular box via "within" function. I was able to get it working with your kdtree_impl, but I encountered panics in certain conditions.

assertion failed: (0..Q::dim()).all(|k| query[0].at(k) <= query[1].at(k))', kd-tree-0.5.1\src\lib.rs:305:9

It seems that kd-tree expects points to be sorted along [1,1] axis, however, as I am not proficient with macros, I could not get the points sorted inside your kdtree_impl.

Otherwise works fine. Should I make a pull request? I am open to feedback.

VitalyArtemiev avatar Oct 06 '23 22:10 VitalyArtemiev

Nevermind, I figured out the sorting.

VitalyArtemiev avatar Oct 06 '23 22:10 VitalyArtemiev