Point

class foronoi.graph.Point(x=None, y=None, name=None, first_edge=None)

A cell point a.k.a. a site. Extends the Coordinate class.

Examples

Site operations

>>> size: float = site.area()                 # The area of the cell
>>> borders: List[HalfEdge] = site.borders()  # Borders around this cell point
>>> vertices: List[Vertex] = site.vertices()  # Vertices around this cell point
>>> site_x: float = site.x                    # X-coordinate of the site
>>> site_xy: [float, float] = site.xy         # (x, y)-coordinates of the site
>>> first_edge: HalfEdge = site.first_edge    # First edge of the site's border
Parameters
  • x (Decimal) – The x-coordinate of the point

  • y (Decimal) – They y-coordinate of the point

  • metadata (dict) – Optional metadata stored in a dictionary

  • name (str) – A name to easily identify this point

  • first_edge (HalfEdge) – Pointer to the first edge

name

A name to easily identify this point

Type

str

first_edge

Pointer to the first edge

Type

HalfEdge

area(digits=None)

Calculate the cell size of the cell that this point is the cell point of. Under the hood, the shoelace algorithm is used.

Parameters

digits (int) – The number of digits to round to

Returns

area – The area of the cell

Return type

float

borders()

Get a list of all the borders that surround this cell point.

Returns

edges – The list of borders, or None if not all borders are present (when the voronoi diagram is under construction)

Return type

list(HalfEdge) or None

vertices()

Get a list of all the vertices that surround this cell point.

Returns

vertices – The list of vertices, or None if not all borders are present (when the voronoi diagram is under construction)

Return type

list(Vertex) or None