Skip to main content
← Back to kicad-monkey Rust Docs kicad-monkey Rust Crate API Reference

Module designator_fit

Module designator_fit 

Source
Expand description

Canonical source-neutral assembly-designator fitting shared by FabView virtual layers (ASSEMBLY_DESIGNATORS_*) and kcr pcb-svg / toon.

Matches pcbe’s primary assembly.rs fitter: hole-preserving MultiPolygon containment, deterministic multi-center candidate search (centroid, interior point, bbox center, per-part centers, 3x3 interior grid), 12-step binary search, and an explicit horizontal (0 deg) tie-breaker on equal/square fits.

Structs§

DesignatorFit
One fitted component designator placement in millimetres (+Y up or canvas space).
DesignatorFitSession
Relative-fit memoization session for fitting designators across a board.

Constants§

DEFAULT_OBLIQUE_MIN_ASPECT_RATIO
Minimum component aspect ratio (long / short) required before an oblique component (e.g. 45 deg) rotates its designator off horizontal/orthogonal.

Functions§

normalize_designator_axis
Normalize an orientation angle into [-90, 90) degrees.
pad_envelope
Convex hull envelope over a component’s pad polygons.
region_from_evenodd_layers
Combine already-closed projected rings with SVG’s even-odd rule per layer, then union the visible layers into one annotation region.
ring_polygon
Build a valid positive-area polygon from a ring of 2D mm coordinates.
subtract_cutouts
Subtract board cutouts from an annotation region so labels never sit over empty air.