HalfEdge¶

class
foronoi.graph.
HalfEdge
(incident_point, twin=None, origin=None)¶ Edges are normally treated as undirected and shared between faces. However, for some tasks (such as simplifying or cleaning geometry) it is useful to view faces as each having their own edges. You can think of this as splitting each shared undirected edge along its length into two half edges. (Boundary edges of course will only have one “halfedge”.) Each halfedge is directed (it has a start vertex and an end vertex).
The halfedge properties let you quickly find a halfedge’s source and destination vertex, the next halfedge, get the other halfedge from the same edge, find all halfedges sharing a given point, and other manipulations.
Examples
Get the halfedge’s source
>>> edge.origin
Get the halfedge’s destination
>>> edge.target # or edge.twin.origin
Get the previous and next halfedge
>>> edge.prev >>> edge.next
Get the other halfedge from the same edge
>>> edge.twin
Find all halfedges sharing a given point
>>> edge.origin.connected_edges
 Parameters
incident_point (Point) – The cell point of which this edge is the border
twin (HalfEdge) – The other halfedge from the same edge
origin (Breakpoint or Vertex) – The origin of the half edge. Can be a Breakpoint or a Vertex during construction, and only Vertex when the diagram is finished.

delete
()¶ Delete this half edge by pointing the previous edge to the next, and removing it from the origin’s connected edges list.

get_origin
(y=None, max_y=None)¶ Get the coordinates of the edge’s origin. During construction of the Voronoi diagram, the origin can be a vertex, which has a fixed location, or a breakpoint, which is a breakpoint between two moving arcs. In the latter case, we need to calculate the position based on the ycoordinate of the sweep line.
 Parameters
y (Decimal) – The ycoordinate of the sweep line.
max_y – Bounding box top for clipping infinitely highly positioned breakpoints.
 Returns
origin
 Return type