二维开放和闭合路径的工具
pypathlib的Python项目详细描述
pypathlib
用于处理二维路径/多边形的轻量级包。
importpypathlib# Create pathpath=pypathlib.ClosedPath([[0,0],[0,1],[1,1],[1,0]])# Get the squared distance of some points to the pathpath.squared_distance([[0.5,0.5],[0.1,2.4]])# Get the _signed_ squared distance of some points to the path# (negative if inside the path)path.signed_squared_distance([[0.5,0.5],[0.1,2.4]])# Check if the path contains the points# (with a tolerance; set negative if you want to exclude the boundary)path.contains_points([[0.5,0.5],[0.1,2.4]],tol=1.0e-12)
pypathlib是完全矢量化的,所以它非常快。(速度不如
^{
相关出版物
安装
pypathlib是available from the Python Package Index,所以只需键入
pip install -U pypathlib
安装或升级。
测试
要运行pypathlib单元测试,请签出此存储库并键入
pytest
分布
创建新版本
把
__version__
号撞一下,发布到pypi和github:
make publish
许可证
pypathlib发布在MIT license下。