Skip to main content

A package for 2D geometry in Python

Project description

pyGeom2D

Python package to create 2D geometries.

Getting Started

Installation

pip install pyGeom2D

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("line_demo.png")

Triangle Demo

from pygeom import Axes, Point, Triangle

# 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

# 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

# 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


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.2.tar.gz (66.9 kB view details)

Uploaded Source

Built Distribution

pyGeom2D-0.1.2-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file pyGeom2D-0.1.2.tar.gz.

File metadata

  • Download URL: pyGeom2D-0.1.2.tar.gz
  • Upload date:
  • Size: 66.9 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.54.0 CPython/3.6.9

File hashes

Hashes for pyGeom2D-0.1.2.tar.gz
Algorithm Hash digest
SHA256 9ac5c8622b72e48592b7bcc574867f348d771b3638527637531b30532fc009e2
MD5 8c49f8c0cfa821bec65e93ec72751233
BLAKE2b-256 51107dfb221fcb50b3442d3b9301891ec9e1d043c21a035b55323f914e003eb1

See more details on using hashes here.

File details

Details for the file pyGeom2D-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pyGeom2D-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.8 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.54.0 CPython/3.6.9

File hashes

Hashes for pyGeom2D-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0ac569917fb6dec50a791ad071c34c77f587d257d5cce0c3758931342ac3a128
MD5 adab9227cefac7be1cd2dbe817554727
BLAKE2b-256 6c5cff31b203bb8bfc4ee709442e5bc8acf739dfe8f8c9064c32d0cce4ee14fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page