Pure Python Quadtree Implementation

ε祈祈猫儿з 提交于 2019-12-23 09:39:14

问题


All,

There are a few examples on implementing a quadtree using Python but my question is, does anyone know of a class written in pure python as in a single .py file that I can easily include in my project? The three most popular packages are listed here Are any of these quad-tree libraries any good? but I have not had luck with using them because of all the dependencies required to run them. I am really going for something lighweight and relatively simple to use. I would like to call the script by passing in the bounds for the entire globe and work down from there. myMethod((-180,-90,180,90))

Thanks, Adam


回答1:


PyQuadTree is a pretty lightweight module (that I built based on someone else's code). It's written in pure-Python, has no dependencies, and doesn't require any installation or compiling at all. It's a single .py file that can be easily included as part of bigger project, which sounds like what is being asked about here.

It also has documentation and supports both Python 2x and 3x.




回答2:


Take a look at Rect. You'll need 2 files. You can merge them into one.



来源:https://stackoverflow.com/questions/6060302/pure-python-quadtree-implementation

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!