tiny2d

A python library for basic 2-D geometry.


License
MIT
Install
pip install tiny2d==0.0.2

Documentation

tiny2d

This tiny library is for dealing with application of 2D geometry in Python.

Installation

Run pip

pip install tiny2d

or install the development version from github

pip install git+https://github.com/ngroup/tiny2d@master

Usage

A minimal tiny2d application looks like this:

import tiny2d as t2d

# create a Polygon
polygon = t2d.Polygon([(1, 1), (1, 2), (2, 3), (3, 2.6), (2.5, 0)])

# tell whether a point is inside the polygon
polygon.contains(1.5, 1.5) # True
polygon.contains(0, 1.5) # False

Vector2D

vec1 = Vector2D(1, 2)
vec2 = Vector2D(3, 5)
vec1 += vec2 # vec1 = (4, 7)