Expand description
Validated, deterministic planar boolean overlay and offset.
A straight ring’s orientation and its ZeroArea check are exact signs
of its area taken as a fan of triangles from its first vertex (#274):
a shoelace over the coordinates as given rounds at the size of the
coordinates squared, which at georeferenced plan positions swamps the
area of a small ring. Areas reported as values are summed the same way,
so their rounding scales with the ring’s extent, not its position.
scripts/probe_ring_orientation_mutants.py lists the faults the tests
in tests/far_from_origin.rs must catch.
Whether two boundary edges meet, the SelfIntersection rule, is exact
too, and validation and settling share it (contact, #272): an end on
the other edge within the tolerance, or a proper crossing with each
segment’s ends strictly on both sides of the other’s line. So an
operation’s settled output is a valid operand wherever it lies.
A degenerate input ring refuses the operation by default. Asked
explicitly, overlay_with and union_soup_with leave out a ring
that is too short, has a repeated vertex, or has zero area under the
exact ZeroArea rule, and report each one with its area
(degenerate, #256); a self-intersecting ring is never dropped.
scripts/probe_degenerate_drop_mutants.py lists the faults the tests
in tests/degenerate_drop.rs must catch.
A Region’s rings lie apart and nested: every hole inside its own
outer ring and in no other of its holes, and no point in two polygons
(nesting, #448). Region::new decides that exactly, on one
arrangement of all the rings, and refuses by name; rings may touch.
Operands of overlay and union_soup are not held to it: their
rings may overlap, read by the fill rule.
scripts/probe_region_nesting_mutants.py lists the faults the tests in
tests/region_nesting.rs must catch.
Structs§
- ArcArrangement
- The plane cut by several simple arc rings.
- ArcCheck
Options - Options of
check_arc_polygon_with. - ArcOverlay
Evidence - Evidence that the arc path did what it claims.
- ArcOverlay
Result - The result of an arc-aware boolean.
- ArcPolygon
- An arc-aware region: one outer boundary and its holes.
- ArcPolygon
Check - The result of
check_arc_polygon. - ArcRing
- A closed boundary whose edges may be arcs.
- ArcRing
Contact - A point where two different rings meet.
- ArcVertex
- One boundary vertex and the bulge of the edge leaving it.
- Arrangement
Edge - One piece of the subdivision: part of one or more input edges, running between two vertices with no other ring’s boundary crossing it.
- Arrangement
Edge Use - One use of a piece in a region boundary.
- Arrangement
Region - A region of the subdivision: an outer boundary and its holes.
- Bridge
- A segment added across a gap narrower than the closing width.
- Circle
Evidence - Which points determine the circle and how exact the output is.
- Dropped
Ring - One input ring an operation left out, and why.
- Edge
Source - Where a piece of the subdivision came from.
- Enclosing
Circle - A circle by its centre and radius.
- Exact
Point2 - A planar point with exact rational coordinates.
- Free
Face - A bounded free face.
- Free
Face Evidence - What the operation did besides the faces.
- Free
Faces - The bounded free faces of a
FreeSpaceInput(module docs). - Free
Ring - A closed boundary of a free face.
- Free
Space Input - What blocks free space: obstacle polygons and open segments.
- Incidence
- One segment through a reported point.
- Intersection
Point - A point where two or more segments meet.
- Minimum
Circle - The circle and its evidence.
- Minimum
Rectangle - The rectangle and its evidence.
- Morphology
Bound - How a disc morphology’s result relates to the exact one.
- Offset
Evidence - What an offset actually did.
- Offset
Result - Result of an offset.
- Oriented
Rectangle - A rectangle by its centre, two unit axes and the half extents along them.
- Overlay
Evidence - Overlay
Input - Overlay
Options - Options for
crate::overlay_withandcrate::union_soup_with. - Overlay
Result - Polygon
- Rectangle
Evidence - What the construction did and how exact its output is.
- Region
- A validated planar region: a normalised set of polygons with holes, whose holes lie apart inside their outer rings and whose polygons do not overlap (#448).
- Region
Evidence - What an operation did to produce a region.
- Reported
Overlay - An overlay’s result and the rings it dropped (#256).
- Reported
Union - A soup union’s polygons and the rings it dropped (#256).
- Ring
- Segment
Intersections - The result of
segment_intersections. - Segment
Overlap - A collinear piece shared by two or more segments.
- Sweep
Evidence - What the sweep did, for measurement.
Enums§
- ArcPolygon
Defect - Why an
ArcPolygondoes not bound a valid region. - ArcRing
Ref - A ring of an
ArcPolygon: the outer boundary or holek. - Barrier
Defect - Why a barrier is refused.
- Bound
Side - Which side of the exact disc morphology a region lies on.
- CapStyle
- How an open stroke terminates.
- Circle
Error - Why no circle was built.
- Degenerate
Rings - What an operation does with a degenerate input ring (#256).
- Drop
Reason - Why a ring was dropped.
- Face
Location - Where a point lies relative to a
FreeFaces. - Fill
Rule - Free
Faces Error - Why no free faces were built.
- Join
Style - How the outline turns a corner.
- Minkowski
Error - Why a Minkowski operation was refused.
- Morphology
Mode - How the disc morphology (
Region::erode_inner_withand its siblings) is computed (#330). - Overlay
Error - Overlay
Operand - Which operand a dropped ring came from.
- Overlay
Operation - Overlay
Refusal - Why a budgeted overlay gave no result.
- Piece
Source - The input an edge of a free face lies on.
- Rectangle
Error - Why no rectangle was built.
- Ring
Role - Which ring of its polygon a dropped ring was.
- Segment
Location - Where on a segment an incidence lies, in the segment’s own direction
(
Startis the segment’s first point as given). - Segment
Sweep Error - Why the sweep refused its input.
- Visibility
Error - Why no visibility polygon was built.
Functions§
- arc_
edge_ radius - Arc radius implied by an edge, or
Nonefor a straight edge. - arc_
overlay - Boolean of two arc-capable regions.
- arc_
ring_ area - Signed area enclosed by an arc ring.
- check_
arc_ polygon - Exact validity of an arc polygon: rings simple, holes nested.
- check_
arc_ polygon_ with check_arc_polygonwith options (#388): the default options are exactlycheck_arc_polygon;ArcCheckOptions::with_clearanceadds the clearance defects.- free_
faces - The bounded free faces of
input, closing gaps narrower thangap. - free_
faces_ within free_faceswith execution options: the memory budget (ADR 0088) and the cancellation token; the tolerance isexecution.tolerance().- minimum_
area_ rectangle - The minimum-area rectangle enclosing
points. - minimum_
enclosing_ circle - The minimum circle enclosing
points. - offset_
polygons - Offset closed polygons by
distance. - overlay
- Performs a neutral planar overlay. Output ordering is deterministic: polygons sort by outer-ring lexicographic start, rings are canonicalized CCW/CW.
- overlay_
with overlaywith explicit options; the default options make itoverlayexactly.- overlay_
within overlay_withunder the caller’s execution options (#338): the tolerance isExecutionOptions::tolerance, and withExecutionOptions::with_memory_budgetthe subdivision is refused withOverlayRefusal::BudgetExceededbefore it would hold more than the budget. Without a budget it isoverlay_withexactly, its refusals wrapped inOverlayRefusal::Invalid. An admitted call gives the same result asoverlay_with, bit for bit. No other option is read: a cancellation token is not polled.- polygon_
area - Net area of a polygon: outer boundary minus its holes.
- reverse_
arc_ ring - Reverse a ring’s orientation, preserving its geometry.
- ring_
area - Absolute area of a ring.
- segment_
intersections - Every intersection among
segments, exactly, by a Bentley–Ottmann sweep inO((n + k) log n)time forkreported incidences. - stroke_
polyline - Sweep an open polyline into a closed region of the given width.
- total_
area - Total net area across a set of polygons.
- union_
soup - Union a set of individually-valid rings that may overlap each other.
- union_
soup_ with union_soupwith explicit options; the default options make itunion_soupexactly.- union_
soup_ within union_soup_withunder the caller’s execution options (#338), asoverlay_withinisoverlay_with: the tolerance isExecutionOptions::tolerance, and a memory budget refuses the subdivision withOverlayRefusal::BudgetExceededbefore it would hold more. Without a budget it isunion_soup_withexactly.- validate_
arc_ ring - Validate an arc ring against the same contract as
crate::Ring, plus the arc-specific degeneracies.