New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

poly-check-b

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Malware was recently detected in this package.

Affected versions:

1.0.0

poly-check-b

Poly-Check-B is a lightweight, dependency-free Python library for validating and analyzing simple 2D

pipPyPI
Version
1.0.0
Weekly downloads
30
Maintainers
0
Weekly downloads
 
Created

Poly-Check-B

Poly-Check-B is a lightweight, dependency-free Python library for validating and analyzing simple 2D polygons. It answers common geometry questions: Is this polygon simple? Convex? Clockwise? Degenerate?

Features

  • Self-intersection (simplicity) detection
  • Convexity and orientation checks (CW/CCW)
  • Duplicate and collinear-vertex detection
  • Signed area and perimeter computation
  • Point-in-polygon testing
  • Pure Python, zero external dependencies

Install

pip install poly-check-b

Usage

from poly_check_b import Polygon

square = Polygon([(0, 0), (4, 0), (4, 4), (0, 4)])

print(square.is_simple())     # True
print(square.is_convex())     # True
print(square.orientation())   # ccw
print(square.area())          # 16.0
print(square.contains(2, 2))  # True

bowtie = Polygon([(0, 0), (2, 2), (2, 0), (0, 2)])
print(bowtie.is_simple())     # False
print(bowtie.errors())        # ['self-intersection at (1.0, 1.0)']

License

MIT

FAQs

Related posts