Skip to main content

Polygen2D

standard-readme compliant

背景

在使用Python处理2D散点图时,发现当下Python库中对平面坐标系的少之又少,想要对点、线、多边形进行操作和判断实在不方便,Polygen2D应运而生,Polygen2D旨在解决2D平台下对散点的处理,将散点抽象为多边形等。

安装

这个项目基于Python3。请确保你本地安装的Python版本大于3。

$ pip install Polygen2D
$ # pip3 install Polygen2D # 如果使用的是pip3

示例

这里的参考程序通过Numpy生成了多边形数据点后生成对应的点、线和面来进行判断点是否在多边形内、计算点到线的距离。

from Polygen2D import Point, Line, Polygen
import numpy as np
x = np.array([0, 5, 5, 0])
y = np.array([0, 0, 5, 5])
points: [Point] = [] # 多边形点集
for i in range(len(x)):
  points.append(Point(x=x[i],y=y[i]))
polygen = Polygen(points) # 多边形初始化
test_point1 = Point(x=1, y=1)
test_point2 = Point(x=-1, y=-1)
test_point3 = Point(x=5, y=2)
test_line = Line(test_point1, test_point2)
print("test_point1 In Polygen?", polygen.contain(test_point1)) # 判断test_point1是否在多边形内
print("test_point2 In Polygen?", polygen.contain(test_point2)) # 判断test_point2是否在多边形内
print("the distance between test_point3 and test_line:", test_line.distance(test_point3)) # 点test_point3到线test_line的距离

更多

如果想要将散点图生成具体图像可以借助matplotlib来实现。

维护者

@Littleor。

如何贡献

非常欢迎你的加入!提一个 Issue 或者提交一个 Pull Request。

标准 Readme 遵循 Contributor Covenant 行为规范。

使用许可

MIT © Littleor

Metadata

Release files for Polygen2D 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Polygen2D 0.1.2
File Size Uploaded Provenance Actions
Polygen2D-0.1.2.tar.gz 6.0 kB Without provenance Details for Polygen2D-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Polygen2D 0.1.2
File Interpreter ABI Platform Actions
Polygen2D-0.1.2-py2.py3-none-any.whl Python 3, Python 2 none any Details for Polygen2D-0.1.2-py2.py3-none-any.whl

Total release size: 11.7 kB

Release files / Polygen2D-0.1.2.tar.gz

Download URL Polygen2D-0.1.2.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
46aa66b325362d1c6c7293314442fb871d64b23492c82593e98d808025c22938
BLAKE2b-256 checksum
How to use checksums
f88e4e9c574af1cd0820e7f5e29703aa99c69f351f5bf52f5753c7d0d756a1e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.5

Release files / Polygen2D-0.1.2-py2.py3-none-any.whl

Download URL Polygen2D-0.1.2-py2.py3-none-any.whl
Size 5.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
1f3ddf19f7f8b609eb60bd35794368674fb24b96cb7d7ee65e8e66e82d673844
BLAKE2b-256 checksum
How to use checksums
95e8645184fd02f95dc88630e20c596f54cfc7b53e4f1db2de1309d4cdc19805
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.6.5

Security for Polygen2D 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page