{"id":15918523,"url":"https://github.com/trmid/pocket","last_synced_at":"2025-11-09T03:03:48.462Z","repository":{"id":143761647,"uuid":"317992870","full_name":"trmid/pocket","owner":"trmid","description":"An efficient and scalable method of managing particle systems.","archived":false,"fork":false,"pushed_at":"2023-08-30T19:33:05.000Z","size":99,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-20T04:48:06.434Z","etag":null,"topics":["javascript","particles","positional-queries","scalable","typescript"],"latest_commit_sha":null,"homepage":"https://pocket.trmid.ca","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/trmid.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2020-12-02T21:13:14.000Z","updated_at":"2023-08-28T15:06:57.000Z","dependencies_parsed_at":"2023-12-26T08:11:55.008Z","dependency_job_id":null,"html_url":"https://github.com/trmid/pocket","commit_stats":{"total_commits":37,"total_committers":3,"mean_commits":"12.333333333333334","dds":0.5135135135135135,"last_synced_commit":"585ee257bda4ff7a5e583d064daf9efb52d6f565"},"previous_names":["midpoint68/pocket"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trmid%2Fpocket","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trmid%2Fpocket/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trmid%2Fpocket/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/trmid%2Fpocket/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/trmid","download_url":"https://codeload.github.com/trmid/pocket/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246998217,"owners_count":20866696,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","particles","positional-queries","scalable","typescript"],"created_at":"2024-10-06T18:42:30.698Z","updated_at":"2025-11-09T03:03:48.370Z","avatar_url":"https://github.com/trmid.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pocket Particles\nA simple particle manager for JavaScript that enables efficient positional queries by dynamically grouping particles into recursively smaller sub pockets.\n\n\u003e *This is the successor to a previously known packaage: `@midpoint68/pocket`*\n\n## Installation\n\n```bash\nnpm i pocket-particles\n```\n\n```typescript\nimport { Pocket, Particle } from \"pocket-particles\";\n```\n\n## Creating a Pocket\n\n```javascript\nvar pocket = new Pocket();\n```\n\n## Adding Particles to a Pocket\n\n```javascript\n// Add 1000 particles with random locations within the bounds (0, 0, 0) and (100, 100, 100)\nfor(let i = 0; i \u003c 1000; i++){\n  pocket.put(new Particle({\n    data: 'Particle #'+i,\n    x: Math.random()*100,\n    y: Math.random()*100,\n    z: Math.random()*100,\n    radius: 0.5\n  }));\n}\n```\n\n## Searching for Particles\n\n```javascript\n// Get a Set of all particles within a 10 unit radius of the point (50, 50, 50)\nconst particles = pocket.search(10, {x: 50, y: 50, z: 50});\n```\n\n## Getting the Closest Particle\n\n```javascript\n// Get only the closest particle to the point (50, 50, 50)\nconst closest = pocket.closest({x: 50, y: 50, z: 50});\n```\n\n## Moving a Particle\n\n```javascript\n// Get the closest particle to (50, 50, 50) and move it to (0, 0, 0)\nconst closest = pocket.closest({x: 50, y: 50, z: 50});\nclosest.moveTo({x: 0, y: 0, z: 0});\n\n// You can also edit individual components of the particle. Keep in mind when editing more than one dimension of the particle's position, it is more effecient to use `Particle.moveTo(...)`.\nclosest.x = 0;\nclosest.y = 0;\nclosest.z = 0;\n```\n\n## Updating a particle's radius\n\n```javascript\n// You can directly update the particle's radius via the `radius` setter.\nparticle.radius = 10;\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrmid%2Fpocket","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftrmid%2Fpocket","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftrmid%2Fpocket/lists"}