纯Python四叉树实现

发布于 2024-11-08 07:58:53 字数 363 浏览 0 评论 0原文

所有,

有一些使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

烦人精 2024-11-15 07:58:53

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.

定格我的天空 2024-11-15 07:58:53

看一下矩形。您将需要 2 个文件。您可以将它们合并为一个。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文