Edges

Edges

Contours and edge pairs. For extended, in is the left normal of the edge (the interior of a counter-clockwise hull).

← Language overview

edges(a)

Available · yields edges

layer e = edges(a)

Each contour segment as an open edge. A closed ring is not doubled (the last=first point is omitted once). Zero length (a==b) is skipped.

Input Result

An empty polygon / fewer than 2 points: no edges. A hole: edges of the hole ring and of the hull — orientation stays as stored (hole clockwise). Edge pairs as input: both edges of the pair, not the distance. Already edges: identity.

first_edges(p)

Available · yields edges

layer e1 = first_edges(width(m1) < 0.14 um)

First edge of each edge pair (e1). From polygons: falls back to edges() (the whole contour).

Input Result Red = pair, right = e1 only

An empty pair list: empty. The dummy marker of empty / count: edge (0,0)-(1,0). second_edges is the same for e2 — for width, e2 is the opposite edge.

second_edges(p)

Available · yields edges

layer e2 = second_edges(p)

Second edge of each pair.

Input Result

Same as first_edges, other side. A degenerate pair (point marker from ongrid): e2 identical to e1 (a point edge).

extended(e, d)

Available · yields polygons

layer p = extended(e, 0.05 um)

Each edge becomes a quad: out and in each d. in = left normal (-uy, ux); on a CCW hull that is the interior. Then merged().

Input Result

Also written as: extended(e, out=d, in=d)

All four lengths 0: empty (not the original). A zero-length edge is skipped. Only out (extended_out / in=0): a band outside; on the inner edge of a hole, in points into the metal. begin / end extend tangentially at the start or end — they can run past corners and overlap neighbour bands, then merge. Quad corners are rounded to whole dbu; very skew edges can get a 1 dbu stair.

extended_out / extended_in

Available · yields polygons

layer o = extended_out(e, 0.05 um)
layer i = extended_in(e, 0.05 um)

Short forms for extended(e, out=d, in=0) and out=0, in=d. Full form: extended(e, out=…, in=…, begin=…, end=…).

Input Result in ↓ out ↑

Also written as: extended(e, out=d, in=0)

One side 0: the quad still has the width of the other side; both 0 and begin/end 0: empty. A negative out/in reverses the direction (the sign is used, not the absolute value).

start_segments / end_segments / centers

Available · yields edges

layer s = start_segments(e, 0.2 um)

Part of the edge from the start, from the end, or a middle piece of length d. Polygons become edges first.

Input Result

d = 0 or a degenerate edge: no piece. d longer than the edge: clamp to the full edge.

corners(a)

Available · yields polygons / edges

layer c = corners(a)
layer c = corners(a, 80, 100)

Corners as 2×2 dbu boxes, optionally with an interior-angle window (absolute turn).

Input Result

180° (collinear): angle 0; without a window still a point, with a window often dropped. The angle window is the same idea as with_angle.

bbox_center(a)

Available · yields polygons / edges

layer c = bbox_center(a)

Centre of the shape bounding box as a 2×2 dbu box (anchor).

Input Result

One shape → one marker. Integer centre: (min+max)/2. An empty layer: empty.

intersections(e1, e2)

Available · yields edges / points

layer p = intersections(e1, e2)

Proper crossings of two edge layers as 2×2 dbu boxes. Endpoints on the other edge do not count (open interval).

Input Result

Parallel without overlap: empty. Collinear overlap: no crossing in this kernel. A T-junction (endpoint on an edge): currently no hit.

with_edge(a, b)

Available · yields polygons

layer w = with_edge(a, b)

A-shapes that have at least one collinear edge piece on B. B is converted to edges if needed.

Input Result

Only a shared vertex without an edge piece: no. A completely in B without a shared contour edge: no.

polygons(x)

Available · yields polygons

layer p = polygons(width(m1) < 0.14 um)
layer p = polygons(e, 0.02 um)

Edge pairs → quadrilateral e1.a–e1.b–e2.b–e2.a. Fewer than 3 unique points: a 2×2 dbu box around the point. Optional second argument: then sized(d).

Input Result

An edge layer instead of pairs: a 1 dbu tube. Already polygons: identity, plus optional sized. Opposite pair orientation can produce a rotated or crossed quad; the area can be almost 0.