Edges, corners, and curves¶
Edges¶
a.edges() returns directed segments. Raw/merged source geometry determines
which seams exist. a.convex_edges() selects edges with convex endpoints.
| Call / property | Returns / behavior | What it does and why |
|---|---|---|
e.inside(mask, boundary="exclude"), e.outside(mask, boundary="exclude") |
Edges; clipped portions; boundary also "include" |
Cuts edges at the mask and keeps the inside or outside pieces. Use boundary to decide whether pieces on the mask edge are kept. |
e.interacting(other, inverse=False) |
Whole Edges; other is Region or Edges |
Keeps complete edges that touch or cross the other geometry. Use it to select source edges without cutting them into smaller pieces. |
e.length_between(minimum=None, maximum=None, ...) |
Whole-edge length interval | Keeps whole edges whose length falls in the chosen range. Use it to apply a rule only to short or long edges. |
e.expand(start=0, end=0, inward=0, outward=0, join_corners=False) |
Oriented ribbon Region |
Turns each directed edge into a polygon strip, with optional end extensions. Use inward/outward sizes to make a keepout or a visible edge marker. |
e.angle_between(minimum=None, maximum=None, absolute=False, ...) |
Directed / absolute angle interval in degrees | Keeps whole edges in the chosen angle range. Directed angles distinguish travel direction; absolute angles treat opposite directions alike. |
e.length, e.angle |
Number; total length / singleton directed angle |
length adds the segment lengths; angle reads the direction of one edge. Use a per-edge builder when checking each edge's own angle. |
e.start_x, e.start_y, e.end_x, e.end_y |
Singleton endpoint Number values |
Reads one edge's start and end coordinates. Use them inside a per-edge builder to build markers or compare endpoints. |
e.filter(lambda edge: predicate), e.map_regions(lambda edge: region) |
Edges / mapped Region |
filter() keeps edges meeting a condition; map_regions() builds polygon output from each edge. Use them for custom edge selection and markers. |
e.raw(), e.implicit(), e.merged() |
Retain occurrences, use merged semantics, or merge connected collinear segments with matching direction | raw() keeps stored edges; implicit() uses merged edges in checks; merged() joins touching collinear edges with the same direction. Choose based on whether individual pieces must remain visible. |
e.members(other, inverse=False) |
Exact membership, including direction | Keeps edges exactly present in the other set, including their direction and endpoints. Use it for exact membership rather than partial coincidence. |
e.split_inside(mask) |
Edges; split at boundary; retain segments with an inside integer midpoint |
Splits edges at mask crossings and keeps pieces whose rounded midpoint is inside, including the boundary. Use it when the rule calls for this midpoint-based selection. |
e.contained_by(mask, inverse=False) |
Whole edges contained by Region | Keeps complete edges contained by the mask, or the opposite with inverse=True. Use it when partial edge pieces would change the intended rule. |
e.coincident(other, side="any", inverse=False) |
Coincident portions; side also "same", "opposite" |
Keeps portions lying on another edge. Use side to distinguish matching directions from opposite directions, such as shared boundaries. |
e.connected_to(seeds) |
Connected Edges containing seeds; endpoint connections only |
Keeps whole endpoint-connected edge groups containing the seed edges. Use it to follow connected outlines; crossings halfway along an edge do not join groups. |
e.expand_by(n, side="outward", join_corners=False) |
Region; measured length; side also "inward", "both" |
Builds edge strips using a length calculated at execution. Use it when strip width depends on a measured property rather than a fixed number. |
e.extend(start=0, end=0) |
Extended Edges |
Lengthens each edge along its own line at the start or end. Use it to extend the reach of an edge before a later test. |
Length/angle ranges use the standard endpoints.
Query endpoints or angle inside a per-edge builder, or on exactly one edge.
split_inside() includes the boundary; intersections use the input grid and
midpoint coordinates round down. Direction and duplicates are preserved.
Common distance checks, measurements, and findings helpers also apply.
Edge pairs¶
Pairs keep edge order until explicitly converted.
| Call / property | Returns / behavior | What it does and why |
|---|---|---|
p.first(), p.second(), p.edges() |
First, second, or both Edges |
first() and second() return one side of each pair; edges() returns both. Use them when later work needs individual edges while respecting pair order. |
p.polygons(expansion=0) |
Explicit marker Region |
Turns each pair into polygon marker geometry, with optional expansion. Use it for polygon output; this deliberately gives up the native pair marker type. |
p.interacting(other, inverse=False, minimum=None, maximum=None) |
Whole pairs; filled pair area and boundary touches count | Keeps whole pairs touching the other geometry. Against a Region, the filled area between the edges also counts, so a mask between the edges can select the pair. |
p.curvilinear(projection_limit=..., buffer=...) |
Subtract buffer from the original check threshold | Keeps normal facing axis-aligned pairs, but uses the smaller cutoff for slanted, nonparallel, or short-projection pairs; point-like edges are dropped. Use it for the stated curved-edge allowance. |
p.curvilinear(projection_limit=..., buffered_distance=...) |
Use an explicit signed cutoff | Runs the same curved-edge filter using the supplied cutoff instead of subtracting a buffer. Use it when pairs have no single known original threshold. |
p.filter(lambda pair: predicate), p.map_regions(lambda pair: region) |
Filtered EdgePairs / mapped Region |
filter() keeps pairs meeting a custom condition; map_regions() builds polygon markers from each pair. Use them for checks beyond the built-in pair filters. |
p.with_measurement(property, minimum=None, maximum=None, apply_to="either", ...) |
Length, angle, internal_angle, distance, grid_distance, projection, ; apply_to also "both", "first", "second" |
Keeps pairs based on a chosen measurement. For edge length or angle, apply_to chooses either edge, both, first, or second. Use it to narrow candidate findings. |
p.area_between(minimum=None, maximum=None, ...) |
EdgePairs; enclosed marker area interval |
Keeps pairs whose enclosed marker area falls in the range. Use it to select small or large pair markers without replacing the pairs. |
p.inside(mask), p.not_inside(mask) |
Whole-pair containment / inverse | Keeps whole pairs contained by the mask, including its boundary; not_inside() keeps the rest. Use it to select reporting areas without clipping pairs. |
p.grid_distance |
Number; one pair's distance rounded to the input grid |
Reads one pair's distance rounded to the input grid. Use it when a rule specifically compares integer-grid distances rather than continuous measurements. |
p.corner_only(buffered_distance) |
Corner-qualified pairs | Keeps close tip-to-tip pairs where neither full edge projects onto the other; point-like ends can also qualify. Use it to check corner gaps separately from facing-edge spacing. |
p.orthogonal_intersections(tolerance=1) |
Pair filter; tolerance is an angle in degrees | Removes intersecting pairs at oblique angles and keeps nonintersecting pairs plus near-parallel or right-angle crossings. Use the angle tolerance to allow small deviations. |
p.spacing_tolerance(source_edges, minimum=..., short_edge_length=..., projection_limit=..., allowance=...) |
Filter spacing pairs with physical cutoffs | Applies an allowance to angled pairs or short projections and excludes nonzero short-source-edge cases. Use it only when that spacing exception is part of the rule. |
p.distance_or_radius(minimum_distance, minimum_radius, straight_angle=20, maximum_angle=70) |
Check distance or radius in the chosen angle bands | Keeps near-parallel pairs below the distance limit and more angled pairs below the radius limit. Use it when straight gaps and bends need different tests. |
p.clip_corner_distance(gap) |
Clipped finite rays sharing a vertex | Shortens two finite rays from a shared corner to the part within gap of the other ray. Use it to mark the part of a corner that is too close. |
p.ray_triangles(maximum) |
Triangular Region markers from corner rays |
Builds triangular markers from pairs sharing one endpoint, capped by maximum. Use it to show a corner region; unsuitable or flat pairs produce no triangle. |
p.opposite_connectors(maximum, perpendicular_to="second", nonparallel=True, unique=True) |
Directed connector Edges; reference also "first" |
Builds short connecting edge sides between a pair, using the chosen perpendicular reference. Use it when later geometry work needs the cross-gap connectors. |
Pair ranges use the standard endpoints. Keep native pairs when their measurements or multiplicity matter.
Relative buffers and pair qualification
This resolves to buffered_distance=0.197. Subtraction uses exact decimal values
before grid conversion; the threshold and buffer are not rounded separately.
Supply exactly one of buffer and buffered_distance. A relative buffer is
finite and nonnegative; booleans and numeric strings are rejected. Explicit
cutoffs may be finite signed values. Zero/negative cutoffs are never clamped.
Selections and filters preserve the originating threshold. Joins and choose()
branches must share one known literal threshold; masks and predicates do not
contribute thresholds. Repeated relative filters use the original threshold.
Corner-generated, transformed, mixed-origin, or measured-threshold pairs need
an explicit buffered_distance when the origin is ambiguous. Alternatively,
filter each origin before joining.
spacing_tolerance() keeps the originating check's shielding. Its allowance
applies to angled pairs or short projections; nonzero measurements on short
source edges are excluded.
clip_corner_distance() clips finite rays sharing a vertex to their mutual
distance limit, with half-away-from-zero grid rounding. ray_triangles() caps
rays by Euclidean length, rounds endpoints to nearest-even grid units, and omits
pairs without exactly one common endpoint or with degenerate triangles.
Corners and curves¶
| Call / property | Returns / behavior | What it does and why |
|---|---|---|
a.corners() |
Corners; contour vertices |
Returns the vertices around polygon outlines. Use it to inspect corner angles, adjoining edges, or vertex positions one corner at a time. |
a.corner_pairs(minimum, maximum, inverse=False) |
Adjacent EdgePairs; interior angle in [minimum, maximum) |
Keeps the two full edges adjoining corners in the given angle range. Use it when a corner rule needs both sides, not just a point marker. |
corner.angle, corner.x, corner.y |
Number values |
Reads the corner's interior angle and its X/Y position. Use them for angle conditions or markers centered at the vertex. |
corners.markers(half_size) |
Vertex marker Region |
Places a small square at each corner, extending half_size in each direction. Use it to make vertex-based findings visible in a polygon report. |
corners.edge_pairs() |
Adjacent incoming/outgoing EdgePairs |
Returns each corner's full incoming and outgoing edges as an ordered pair. Use it to measure or build markers from both sides of a vertex. |
corners.inside(mask, inverse=False) |
Corners; boundary included |
Keeps corners inside or on the mask, or the opposite with inverse=True. Use it to limit corner rules to a chosen area. |
corners.stub_pairs(length) |
Outward square-distance stub EdgePairs |
Builds short outward edge-pair stubs with the given square-distance reach. Use them when a corner test needs a limited reach rather than full source edges. |
corner.incoming, corner.outgoing |
Directed singleton Edges |
Reads the edge entering the corner and the edge leaving it. Use their directions and lengths inside a corner builder. |
a.min_radius(radius, marker_half_size=..., exemption_half_size=..., ...) |
Radius marker Region; optional cleanup, resolution_floor, sharp_threshold, angle_gate, scope, exclude |
Reports bends with radius below the requirement, using the selected cleanup, angle gates, and exclusions. Use it for minimum bend-radius rules; marker sizes control reporting geometry. |
Corners support collection filtering, mapping, and reductions. Marker sizes are physical lengths. Radius checking uses explicit sampling, not geometry repair.