fix(points): grid inconsistencies#37
fix(points): grid inconsistencies#37antond15 merged 2 commits intoCommunityOx:mainfrom D4isDAVID:points-fixes
Conversation
If the radius of the point is larger than the cell size then the point can span multiple cells. |
|
@thelindat From my understanding, points are already inserted into all the appropriate cells in |
|
Ah, I guess what I wrote is actually confusing. The parameter for |
|
The purpose of getNearbyEntries is to get entries in the current and surrounding cells, not strictly the current cell. Whether that's necessary depends on the exact use-case, and it's not very sensible to outright change the behaviour. It's redundant in the case of points due to their own distance checks, but that's not strictly what the grid is for. |
|
That makes sense. I'll revert it. |
Fix memory constantly going up when having any points.
Currently, the points thread creates a new filter function every loop iteration and passes it to
lib.grid.getNearbyEntries, which would break caching, as the filter function would be different every iteration.This PR fixes this by creating a local function, and passing it instead, meaning it wouldn't be created over and over, and it would be properly cached.
Fix
onExitnot firing when both exiting a point and moving grid cells in the same loop iteration, whenonEnterisn't set.When moving grid cells, the points thread uses
point.insideto check whether to runonExit. However,point.insideis only set whenonEnteris defined.This PR fixes this by setting
point.insideeven whenonEnterisn't defined.Fixes #20.