geometry

Grid

class supreme.geometry.Grid(rows, cols)

Bases: object

Regular grid.

__init__(rows, cols)
Create a grid given rows and columns.
coords
Return an array of all coordinates.

Polygon

class supreme.geometry.Polygon(xp, yp)

Polygon class

Methods

area() Return the area of the polygon.
centroid() Return the centroid of the polygon
inside(xp, yp) Check whether the given points are inside the polygon.
__init__(xp, yp)

Given xp and yp (both 1D arrays or sequences), create a new polygon. The polygon is closed at instantiation.

p.inside(x, y) - Calculate whether points lie inside the polygon. p.area() - The area enclosed by the polygon. p.centroid() - The centroid of the polygon

area()

Return the area of the polygon.

From Paul Bourke’s webpage:
http://astronomy.swin.edu.au/~pbourke/geometry
centroid()
Return the centroid of the polygon
inside(xp, yp)

Check whether the given points are inside the polygon.

Input:
xp – 1D array of x coordinates for points yp – 1D array of y coordinates for points
Output:
inside – boolean array

See http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html