mkafrin / PolyZone

PolyZone is a FiveM mod to define zones of different shapes and test whether a point is inside or outside of the zone
MIT License
204 stars 189 forks source link

Possible performance improvement to grid calculation #2

Closed mkafrin closed 4 years ago

mkafrin commented 4 years ago

If I understand the math correctly, min should be able to be added to x and y one time, instead of adding it to every vector. Ex) local x = cellX * gridCellWidth + min.x

https://github.com/mkafrin/PolyZone/blob/d5c8462d32305d97012c19f31c40f0349337610f/client.lua#L163-L173

mkafrin commented 4 years ago

Didn't improve performance that much, but is simpler code, so it was added in 64a25ca