{"id":15414916,"url":"https://github.com/lxsmnsyc/q43","last_synced_at":"2026-05-10T12:57:40.204Z","repository":{"id":65481522,"uuid":"140730388","full_name":"lxsmnsyc/Q43","owner":"lxsmnsyc","description":"A Quadtree class for JS/ES","archived":false,"fork":false,"pushed_at":"2018-07-27T14:55:45.000Z","size":397,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-11T22:49:11.646Z","etag":null,"topics":["aabb","axis-aligned-bounding-box","data-structures","datastructures","game","game-dev","game-development","game-engine","graph-algorithms","quad-tree","quadtree","space-partitioning","tree","tree-structure"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/lxsmnsyc.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}},"created_at":"2018-07-12T15:16:39.000Z","updated_at":"2018-07-27T14:55:46.000Z","dependencies_parsed_at":"2023-01-25T16:30:57.276Z","dependency_job_id":null,"html_url":"https://github.com/lxsmnsyc/Q43","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxsmnsyc%2FQ43","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxsmnsyc%2FQ43/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxsmnsyc%2FQ43/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lxsmnsyc%2FQ43/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lxsmnsyc","download_url":"https://codeload.github.com/lxsmnsyc/Q43/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240981558,"owners_count":19888346,"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":["aabb","axis-aligned-bounding-box","data-structures","datastructures","game","game-dev","game-development","game-engine","graph-algorithms","quad-tree","quadtree","space-partitioning","tree","tree-structure"],"created_at":"2024-10-01T17:05:15.016Z","updated_at":"2026-05-10T12:57:40.172Z","avatar_url":"https://github.com/lxsmnsyc.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Q43\nA Quadtree class for JS/ES\n## Install\n```bash\nnpm i q43\n```\n\n### API\n\n\u003ca name=\"Q43\"\u003e\u003c/a\u003e\n## Q43(ax, ay, bx, by, cap) ⇒ \u003ccode\u003eQ43\u003c/code\u003e\nCreate a Q43 instance\n\n**Kind**: global function\n\n| Param | Type | Description |\n| --- | --- | --- |\n| ax | \u003ccode\u003eNumber\u003c/code\u003e | minimum X of the Q43 boundary |\n| ay | \u003ccode\u003eNumber\u003c/code\u003e | minimum Y of the Q43 boundary |\n| bx | \u003ccode\u003eNumber\u003c/code\u003e | maximum X of the Q43 boundary | \n| by | \u003ccode\u003eNumber\u003c/code\u003e | maximum Y of the Q43 boundary |\n| cap | \u003ccode\u003eNumber\u003c/code\u003e | The amount of points a Q43 instance can store. |\n\n\u003ca name=\"containsX\"\u003e\u003c/a\u003e\n## containsX(px) ⇒ \u003ccode\u003eBoolean\u003c/code\u003e\nCheck if x is within the Q43's x-axis\n\n**Kind**: global function\n\n| Param | Type |\n| --- | --- |\n| px | \u003ccode\u003eNumber\u003c/code\u003e |\n\n\u003ca name=\"containsY\"\u003e\u003c/a\u003e\n\n## containsY(py) ⇒ \u003ccode\u003eBoolean\u003c/code\u003e\nCheck if y is within the Q43's x-axis\n\n**Kind**: global function\n\n| Param | Type |\n| --- | --- |\n| py | \u003ccode\u003eNumber\u003c/code\u003e |\n\n\u003ca name=\"containsPoint\"\u003e\u003c/a\u003e\n\n## containsPoint(px, py) ⇒ \u003ccode\u003eBoolean\u003c/code\u003e\nCheck if point is within the Q43's x-axis\n\n**Kind**: global function\n\n| Param | Type |\n| --- | --- |\n| px | \u003ccode\u003eNumber\u003c/code\u003e |\n| py | \u003ccode\u003eNumber\u003c/code\u003e |\n\n\u003ca name=\"subdivide\"\u003e\u003c/a\u003e\n\n## subdivide()\nSubdivide the Q43 into four equal parts.\n\n**Kind**: global function\n\u003ca name=\"insert\"\u003e\u003c/a\u003e\n\n## insert(pt) ⇒ \u003ccode\u003eBoolean\u003c/code\u003e\nInsert a point to the Q43\n\n**Kind**: global function\n\n| Param | Type |\n| --- | --- |\n| pt | \u003ccode\u003eArray\u003c/code\u003e |\n\n\u003ca name=\"remove\"\u003e\u003c/a\u003e\n\n## remove(pt) ⇒ \u003ccode\u003eBoolean\u003c/code\u003e\nRemove a point from the Q43\n\n**Kind**: global function\n\n| Param | Type |\n| --- | --- |\n| pt | \u003ccode\u003eArray\u003c/code\u003e |\n\n\u003ca name=\"query\"\u003e\u003c/a\u003e\n\n## query(cond) ⇒ \u003ccode\u003eArray\u003c/code\u003e\nGet all points from the Q43 given a condition\n\n**Kind**: global function\n**Returns**: \u003ccode\u003eArray\u003c/code\u003e - - array of points\n\n| Param | Type | Description |\n| --- | --- | --- |\n| cond | \u003ccode\u003efunction\u003c/code\u003e | the filter function |\n\n\u003ca name=\"all\"\u003e\u003c/a\u003e\n\n## all() ⇒ \u003ccode\u003eArray\u003c/code\u003e\nGet all points from the Q43\n\n**Kind**: global function\n**Returns**: \u003ccode\u003eArray\u003c/code\u003e - - array of points\n\u003ca name=\"queryBounds\"\u003e\u003c/a\u003e\n\n## queryBounds(ax, ay, bx, by, cond) ⇒ \u003ccode\u003eArray\u003c/code\u003e\nGet all points from a Q43 that is within a given boundary and passes the condition\n\n**Kind**: global function\n**Returns**: \u003ccode\u003eArray\u003c/code\u003e - - array of points\n\n| Param | Type | Description |\n| --- | --- | --- |\n| ax | \u003ccode\u003eNumber\u003c/code\u003e | minimum x of the given boundary |\n| ay | \u003ccode\u003eNumber\u003c/code\u003e | minimum y of the given boundary |\n| bx | \u003ccode\u003eNumber\u003c/code\u003e | maximum x of the given boundary |\n| by | \u003ccode\u003eNumber\u003c/code\u003e | maximum y of the given boundary |\n| cond | \u003ccode\u003efunction\u003c/code\u003e | a filter function, optional |\n\n\u003ca name=\"queryRange\"\u003e\u003c/a\u003e\n\n## queryRange(px, py, radius, cond) ⇒ \u003ccode\u003eArray\u003c/code\u003e\nGets all points within the radius of another point from the Q43\n\n**Kind**: global function\n\n| Param | Type | Description |\n| --- | --- | --- |\n| px | \u003ccode\u003eNumber\u003c/code\u003e |  |\n| py | \u003ccode\u003eNumber\u003c/code\u003e |  |\n| radius | \u003ccode\u003eNumber\u003c/code\u003e |  |\n| cond | \u003ccode\u003efunction\u003c/code\u003e | filter function, optional |\n\n\u003ca name=\"for\"\u003e\u003c/a\u003e\n\n## for(handler)\nIterates all points in the Q43 and passes them to a handler function\n\n**Kind**: global function\n\n| Param | Type |\n| --- | --- |\n| handler | \u003ccode\u003efunction\u003c/code\u003e |\n\n\u003ca name=\"forBounds\"\u003e\u003c/a\u003e\n\n## forBounds(ax, ay, bx, by, handler)\nIterates all points in the Q43 that are within the bounds\nand passes them to a handler function.\n**Kind**: global function\n\n| Param | Type |\n| --- | --- |\n| ax | \u003ccode\u003eNumber\u003c/code\u003e |\n| ay | \u003ccode\u003eNumber\u003c/code\u003e |\n| bx | \u003ccode\u003eNumber\u003c/code\u003e |\n| by | \u003ccode\u003eNumber\u003c/code\u003e |\n| handler | \u003ccode\u003efunction\u003c/code\u003e |\n\n\u003ca name=\"forRange\"\u003e\u003c/a\u003e\n\n## forRange(px, py, radius, handler)\nIterates all points within the radius of another point in the Q43\nand passes them to a handler.\n\n**Kind**: global function\n\n| Param | Type |\n| --- | --- |\n| px | \u003ccode\u003eNumber\u003c/code\u003e |\n| py | \u003ccode\u003eNumber\u003c/code\u003e |\n| radius | \u003ccode\u003eNumber\u003c/code\u003e |\n| handler | \u003ccode\u003efunction\u003c/code\u003e |\n\n\u003ca name=\"rebuild\"\u003e\u003c/a\u003e\n\n## rebuild() ⇒ \u003ccode\u003eQ43\u003c/code\u003e\nThis is useful for rebuilding a quadtree whose points have updated coordinates.\n\n**Kind**: global function\n\u003ca name=\"update\"\u003e\u003c/a\u003e\n\n## update()\nUnlike the rebuild method, the update method does not restore subdivided empty Q43s.\n\n**Kind**: global function\n\u003ca name=\"size\"\u003e\u003c/a\u003e\n\n## size() ⇒ \u003ccode\u003eNumber\u003c/code\u003e\nCalculates the amount of points a Q43 has.\n\n**Kind**: global function\n\u003ca name=\"draw\"\u003e\u003c/a\u003e\n\n## draw(ctx, tree, point)\nFor debugging purposes\n\n**Kind**: global function\n\n| Param | Type |\n| --- | --- |\n| ctx | \u003ccode\u003eCanvasRenderingContext2D\u003c/code\u003e |\n| tree | \u003ccode\u003eBoolean\u003c/code\u003e |\n| point | \u003ccode\u003eBoolean\u003c/code\u003e |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxsmnsyc%2Fq43","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flxsmnsyc%2Fq43","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flxsmnsyc%2Fq43/lists"}