{"id":18275259,"url":"https://github.com/artemeff/quadtree","last_synced_at":"2025-04-09T04:08:30.240Z","repository":{"id":142290326,"uuid":"14332523","full_name":"artemeff/quadtree","owner":"artemeff","description":"Simple QuadTree implementation in pure C99","archived":false,"fork":false,"pushed_at":"2014-02-28T09:35:35.000Z","size":231,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-14T22:30:04.977Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","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/artemeff.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":"2013-11-12T13:13:19.000Z","updated_at":"2020-05-20T04:50:42.000Z","dependencies_parsed_at":"2023-03-13T04:45:47.343Z","dependency_job_id":null,"html_url":"https://github.com/artemeff/quadtree","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/artemeff%2Fquadtree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemeff%2Fquadtree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemeff%2Fquadtree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/artemeff%2Fquadtree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/artemeff","download_url":"https://codeload.github.com/artemeff/quadtree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247974732,"owners_count":21026742,"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":[],"created_at":"2024-11-05T12:12:21.134Z","updated_at":"2025-04-09T04:08:30.221Z","avatar_url":"https://github.com/artemeff.png","language":"C","readme":"### quadtree\n\n---\n\n### Installation\n\n```bash\n$ git clone \u0026\u0026 cd\n$ make\n$ make install\n```\n\n---\n\n### Usage\n\n```c\n#include \u003cstdio.h\u003e\n#include \u003cquadtree.h\u003e\n\nint main() {\n  int val = 10;\n  quadtree_t *tree = quadtree_new(0, 0, 10, 10);\n  quadtree_insert(tree, 1, 1, 1, \u0026val);\n  quadtree_insert(tree, 2, 2, 2, \u0026val);\n  quadtree_insert(tree, 3, 3, 3, \u0026val);\n\n  printf(\"tree length: %d\\n\", tree-\u003elength);\n\n  return 0;\n}\n```\n\nFinds in tree:\n\n```c\nresult_node_t *head, *cur;\n\nvoid within_callback(point_t *point) {\n  printf(\"%d\\n\", point-\u003ex);\n}\n\nquadtree_within(tree-\u003eroot, bbox, within_callback);\n```\n\nWalks in tree:\n\n```c\nvoid ascent(node_t *node) {\n  if (node \u0026\u0026 node-\u003epoint) {\n    printf(\"%d\\n\", node-\u003epoint-\u003ex);\n  }\n}\n\nvoid descent(node_t *node) {\n  if (node \u0026\u0026 node-\u003epoint) {\n    printf(\"%d\\n\", node-\u003epoint-\u003ex);\n  }\n}\n\nquadtree_walk(tree-\u003eroot, \u0026ascent, \u0026descent);\n```\n\nReference:\n\n```c\n// Create new tree and return pointer\nquadtree_t *\nquadtree_new(double minx, double miny, double maxx, double maxy)\n\n// Insert point to the tree and return point pointer\npoint_t *\nquadtree_insert(quadtree_t *tree, double x, double y, void *key, bool update)\n\n// Search if tree has point and return point pointer\npoint_t *\nquadtree_search(quadtree_t *tree, double x, double y)\n\n// Destroy tree\nvoid\nquadtree_free(quadtree_t *tree)\n\n// Walks in tree, works like each for points\nvoid\nquadtree_walk(node_t *root, void (*descent)(node_t *node),\n                            void (*ascent)(node_t *node))\n\n// Find points in bbox\nvoid\nquadtree_within(node_t *root, bounds_t *bounds, within_callback_t cb)\n```\n\n---\n\n### Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Make changes\n4. `make test benchmark`\n5. Commit your changes (`git commit -am 'add some feature'`)\n6. Push to the branch (`git push origin my-new-feature`)\n7. Create new Pull Request\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartemeff%2Fquadtree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fartemeff%2Fquadtree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fartemeff%2Fquadtree/lists"}