A package for 2D geometry in Python
Project description
PyGeometry
Python package to create 2D geometries.
Getting Started
Installation
pip install --index-url https://test.pypi.org/simple/ --no-deps pygeometry-pkg-naysan -U
Usage Examples
Cartesian coordinate axes + points
from pygeom import Axes, Point
# Create the cartesian axis
axes = Axes(xlim=(-1,8), ylim=(-1,18), figsize=(9,7))
# Create two points
p1 = Point(2, 5, color='#ffa500')
p2 = Point(7, 17, color='#0000ff')
axes.addMany([p1, p2])
axes.draw()
Line Demo
from pygeom import Axes, Point, Line
# Create the cartesian axis
axes = Axes(xlim=(-1,7), ylim=(-1,7), figsize=(7,6))
# Points
p1 = Point(1, 1, color='red')
p2 = Point(5, 4, color='green')
l = Line(p1=p1, p2=p2)
axes.addMany([p1, p2, l])
axes.draw()
Triangle Demo
from pygeom import Axes, Point, Triangle
%matplotlib inline # For Jupyter Notebook
# Create the cartesian axis
axes = Axes(xlim=(-1,10), ylim=(-1,10), figsize=(12,10))
# Points
p1 = Point(1, 1, color='grey')
p2 = Point(5, 5, color='grey')
p3 = Point(8, 5, color='grey')
tr = Triangle(p1, p2, p3, alpha=0.5)
axes.addMany([p1, p2, p3])
axes.add(tr)
axes.draw()
Rectangle Demo
from pygeom import Axes, Point, Rectangle
%matplotlib inline
# Create the cartesian axis
axes = Axes(xlim=(-1,7), ylim=(-1,7), figsize=(12,10))
# Points
bottomLeft = Point(1, 1, color='red')
topRight = Point(5, 4, color='green')
shape = Rectangle(bottomLeft, topRight, alpha=0.5)
axes.addMany([bottomLeft, topRight])
axes.add(shape)
axes.draw()
Polygon Demo
from pygeom import Axes, Point, Polygon
%matplotlib inline
# Create the cartesian axis
axes = Axes(xlim=(-1,10), ylim=(-1,10), figsize=(12,10))
# Points
p1 = Point(1, 1, color='red')
p2 = Point(1, 2, color='green')
p3 = Point(4, 7, color='red')
p4 = Point(9, 1, color='green')
shape = Polygon([p1, p2, p3, p4], alpha=0.5)
axes.addMany([p1, p2, p3, p4])
axes.add(shape)
axes.draw()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyGeom2D-0.1.1.tar.gz
(7.7 kB
view details)
Built Distribution
pyGeom2D-0.1.1-py3-none-any.whl
(10.9 kB
view details)
File details
Details for the file pyGeom2D-0.1.1.tar.gz
.
File metadata
- Download URL: pyGeom2D-0.1.1.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
6e2cd06a89b4358b757993f2383676506a45e0b9fd01f19ade89aaba3153cd0a
|
|
MD5 |
63cf8ebc399198598fff7e2ba4503aec
|
|
BLAKE2b-256 |
41d57633a212fe3ca89477893b2584f163f400b7d464d3fd5c334bdedf1b89a9
|
File details
Details for the file pyGeom2D-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: pyGeom2D-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.50.0 CPython/3.6.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
d918a08b71a99655b345cb3cac396ff17177546bb1496bbacf4d9f748ec3f2c2
|
|
MD5 |
341b036c96ced5c4577326fe165af3bd
|
|
BLAKE2b-256 |
6154fb2a041a913447c609e4674ca7ae38f555bb7ddebaa247ef634b3e8e690b
|