Skip to content

Take SpatialQueryFilter by reference in spatial queries#402

Merged
Jondolf merged 5 commits into
mainfrom
query-filter-by-reference
Aug 10, 2024
Merged

Take SpatialQueryFilter by reference in spatial queries#402
Jondolf merged 5 commits into
mainfrom
query-filter-by-reference

Conversation

@Jondolf

@Jondolf Jondolf commented Jul 6, 2024

Copy link
Copy Markdown
Member

Objective

Spatial queries currently take SpatialQueryFilter by value and clone it several times. This could sometimes be cloning a pretty hefty amount of data if the HashSet of excluded entities is large.

Solution

Take spatial query filters by reference and reduce the amount of cloning.

Future Work

Shapecasting with multiple hits should be optimized to only traverse once instead of doing best-first traversals in a loop. See #403.


Migration Guide

Spatial queries performed through SpatialQuery now take SpatialQueryFilter by reference.

@Jondolf Jondolf added A-Spatial-Query Relates to spatial queries, such as ray casting, shape casting, and intersection tests M-Migration-Guide A breaking change to Avian's public API that needs to be noted in a migration guide labels Jul 6, 2024

@janhohenheim janhohenheim left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh nice, you managed to make all of the spatial queries take the filter by reference!

@Jondolf Jondolf merged commit 73fe6c7 into main Aug 10, 2024
@Jondolf Jondolf deleted the query-filter-by-reference branch August 10, 2024 19:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Spatial-Query Relates to spatial queries, such as ray casting, shape casting, and intersection tests M-Migration-Guide A breaking change to Avian's public API that needs to be noted in a migration guide

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants