Polygon¶
-
class
foronoi.graph.
Polygon
(tuples)¶ A bounding polygon that will clip the edges and fit around the Voronoi diagram.
- Parameters
tuples (list[(float, float)]) – x,y-coordinates of the polygon’s vertices
-
finish_edges
(edges, **kwargs)¶ Clip the edges to the bounding box/polygon, and remove edges and vertices that are fully outside. Inserts vertices at the clipped edges’ endings.
-
finish_polygon
(edges, existing_vertices, points)¶ Creates half-edges on the bounding polygon that link with Voronoi diagram’s half-edges and existing vertices.
- Parameters
- Returns
edges (list(HalfEdge)) – The list of all edges including the bounding polygon’s edges
vertices (list(Vertex)) – The list of all vertices including the
-
inside
(point)¶ Tests whether a point is inside a polygon. Based on the Javascript implementation from https://github.com/substack/point-in-polygon
- Parameters
point (Point) – The point for which to check if it it is inside the polygon
- Returns
inside – Whether the point is inside or not
- Return type
bool