pyssaBSS.polygon
Classes
|
Polygon drawer |
- class pyssaBSS.polygon.PolygonDrawer(ax, points, filename='polygons.json')[source]
Bases:
objectPolygon drawer
This can be used to construct polygonal partitions of data points on a given map. The partition can then be saved a JSON file and used for the SPSSA methods.
Usage
- Initialize:
drawer = PolygonDrawer(ax, points)
- Draw polygons:
plt.show()
- Save polygons:
drawer.save(“polygons.json”)
- type ax:
an ax object from pyplot
- param ax:
this is the map on which we draw. The drawer assumes that this is already constructed (e.g. from png and a bounding box)
- type ax:
an ax object from pyplot
- type points:
ndarray of shape (n, 2)
- param points:
the coordinates of the points we want to partition. The points should lie inside the bounding box of the ax figure.
- type points:
ndarray of shape (n, 2)
- MOVE_THRESHOLD = 2
- SNAP_RADIUS_PX = 10