Skip to content

Add "within" support (rectangular axis-alligned region).#23

Open
VitalyArtemiev wants to merge 9 commits intolaundmo:mainfrom
VitalyArtemiev:within
Open

Add "within" support (rectangular axis-alligned region).#23
VitalyArtemiev wants to merge 9 commits intolaundmo:mainfrom
VitalyArtemiev:within

Conversation

@VitalyArtemiev
Copy link
Copy Markdown

Issue #7
Example in distance2d.rs.

@laundmo
Copy link
Copy Markdown
Owner

laundmo commented Oct 13, 2023

Hi!

Thank you a lot for your PR.

i'm a bit wary about expanding the SpatialAccess Trait like this - other data structures, of which i plan to add at least 2 somewhere during the next bevy release cycle, might not support it.

How do you feel about moving that to a extension trait? It would mean users have to import another trait, but leaves the option for other datastructures which don't support it.

@VitalyArtemiev
Copy link
Copy Markdown
Author

Of course, if you think it's best. I'll try implementing it that way.

@VitalyArtemiev
Copy link
Copy Markdown
Author

I finally got around to it. Hope this is what you had in mind.

@cliedelt
Copy link
Copy Markdown

@laundmo can we get this merged?

Example in within2d.rs

Known issues:
Panic when loc1 is farther along the [1,1] axis than loc2. Could not find a way to check this and swap them inside of the macro.
Move example function back into distance2d.rs; remove within2d.rs.
Add separate demo.
@VitalyArtemiev
Copy link
Copy Markdown
Author

Are you still interested in merging this feature? Should I perhaps create a better demo that does not cannibalize your code from distance2d.rs?

@cliedelt
Copy link
Copy Markdown

I think it still super useful. You can have a workaround but this would be better...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants