
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
spatial-hashmap
Advanced tools
Spatial Hashmap is a module for answering the question "What is near an object with these coordinates?". It was created based off the algorithm defined in "Optimization of Large-Scale, Real-Time Simulations by Spatial Hashing"
npm i spatial-hashmap
// pass in the width, height, and cell size
// cell size - use this to control how big a region is returned when asking for nearby objects
const sm = new SpatialManager(100, 100, 10)
// this can be literally anything
const yourObject = {your: 'object'}
// pass in a geometry with this shape
const geometry = {
pos: {
x: 0,
y: 0
},
aabb: {
min: {
x: 0,
y: 0
}
max: {
x: 12,
y: 10
}
}
}
sm.registerObject(yourObject, geometry)
sm.registerObject({your: 'otherObject'}, ...)
// returns Set of nearby objects
sm.getNearby(geometryOfOtherObject)
sm.clearMap()
Empties Spatial Hashmap and reinitializes.
How you get your obj into the map
@param obj - what you want to register in the spatial hashmap
@param geo - a description of the objects position and bounding box
{
// position of the object
pos: {
x: 0,
y: 0
},
// bounding box relative to position
aabb: {
min: {
x: 0,
y: 0
}
max: {
x: 12,
y: 10
}
}
}
Returns all the possible buckets an object's geometry is in as a set
Given a Point return its bucket ID
@param cellsizeInv - 1 / cellsize
@param numcols - the number of cols in the spatial map
Given a Point return its bucket ID
Given a geometry return the objects nearby
FAQs
Broad phase collision detection using a spatial hashmap
We found that spatial-hashmap demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.