纯Python四叉树实现 [英] Pure Python Quadtree Implementation

查看:131
本文介绍了纯Python四叉树实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

全部

有一些使用Python实现四叉树的示例,但是我的问题是,有谁知道用纯python编写的类,就像我可以轻松地将其包含在项目中的单个.py文件中一样吗?以下列出了三个最受欢迎的软件包:树库有什么好处吗?,但是由于运行它们所需的所有依赖关系,我对使用它们没有好运.我真的很想轻量级且易于使用的东西.我想通过传递整个地球的边界并从那里开始工作来调用脚本. myMethod((-180,-90,180,90))

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))

谢谢, 亚当

推荐答案

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.

它也有文档,并且支持Python 2x和3x.

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

这篇关于纯Python四叉树实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆