Ports geometry/planar/Polygon.java (corner de-duplication and collinear removal, winding number) and PolygonShape.java, including the recursive split_to_convex that decomposes a simple polygon into convex Simplex tiles by dividing at concave corners along minimal axis-parallel lines. Orientation and convexity tests are exact; the division-point search is approximate (float line evaluation, split point rounded to an integer corner) as upstream. The concave-corner search starts deterministically at corner 0 rather than a seeded PRNG; this only affects which valid decomposition is produced. Supporting additions: Simplex.from_corners (convex polygon to simplex) and Line.function_value_approx / function_in_y_value_approx. Invariant tests over L, plus, staircase and square polygons: tile areas sum to the polygon area (no gaps, no overlap), a point is in the polygon iff in some tile, and no point is strictly inside more than one tile (interiors disjoint). Also covers Polygon normalization and orientation.
freeroute
A native Python PCB autorouter — a Java-free port of the FreeRouting engine.
Why
kicad-mcp currently autoroutes by shelling out to freerouting.jar, which
drags in a JVM dependency. freeroute reimplements the routing engine in
pure Python so the toolchain needs no Java at all.
The contract
The entire integration surface is two Specctra files:
board.dsn ──▶ freeroute ──▶ board.ses
(unrouted) (routed session: traces + vias)
kicad-cli already exports .dsn and imports .ses, so freeroute is a
drop-in replacement for the JAR step — nothing else in the pipeline changes.
Status
Pre-alpha. Under active development. See docs/PORTING_PLAN.md
for the architecture and porting roadmap.
Usage (target)
freeroute board.dsn -o board.ses
Development
uv sync
uv run pytest
uv run ruff check src/ tests/
License
GPL-3.0-or-later, matching the FreeRouting source it is ported from.
Languages
Python
100%