纯Python四叉树实现
所有,
有一些使用 Python 实现四叉树的示例,但我的问题是,有谁知道用纯 python 编写的类(在单个 .py 文件中),我可以轻松地将其包含在我的项目中?这里列出了三个最受欢迎的软件包 这些是四元包吗?树库有什么好处?但我没有运气使用它们,因为运行它们需要所有依赖项。我真的想要一些轻量级且相对简单易用的东西。我想通过传递整个地球的边界来调用脚本,并从那里开始工作。 myMethod((-180,-90,180,90))
谢谢, 亚当
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
PyQuadTree< /a> 是一个非常轻量级的模块(我根据别人的代码构建)。它是用纯 Python 编写的,没有依赖项,根本不需要任何安装或编译。它是一个单一的 .py 文件,可以很容易地包含在更大的项目中,这听起来就像这里所问的那样。
它还具有文档并支持 Python 2x 和 3x。
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.