nx_gcode_arc_test.nx
buildroot/runtime/nx_gcode_arc_test.nx
about
nx_gcode_arc_test.nx -- verify arc-fit detection + G2/G3 emission.
Test polygon: 4 vertices on a unit circle at 0°/90°/180°/270°:
(1, 0), (0, 1), (-1, 0), (0, -1) [in Q14: 16384, 0, etc]
All on circle centered at (0, 0) radius 1.
Expected with arc_fit_enabled:
- emitter walks polygon
- prev_x=16384, prev_y=0
- tries arc through (16384,0), (0,16384), (-16384,0)
- circle center (0,0) ok
- extends with (0,-16384) -- on circle, fits
- emits single G3 (or G2) from (16384,0) to (0,-16384)
- closes loop back to (16384,0) with one G1
So output should contain "G3 X" (or "G2 X") string.
With arc_fit_enabled=0 (default), output contains only "G1" moves
(no "G2" or "G3").
Closed-form invariants:
(a) Default disabled: emit produces NO G2/G3
(b) Setter enables -> setter returns 0
(c) Setter rejects out-of-range -> returns -1
(d) Enabled emit on circle-polygon -> output contains "G3 X"
(e) Enabled emit on square (4 collinear-ish points NOT on circle)
-> output still works; may or may not emit G3 (square IS a
degenerate 4-pt-on-circle inscribed in a circle, so could
arc-fit -- skip strict check for v1)
expect_exit: 0
license_tier: ORIGINAL
dependencies 6 imports · 0 importers
imports: nx_syscalls.nxnx_polygon.nxnx_slice_contour.nxnx_machine_graph.nxnx_material_profile.nxnx_gcode_emit.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 41 | const Q14: i64 = 16384 |
functions
| 43 | func smoke_contains(buf: *u8, len: i64, needle: *u8) -> i64 called by 1: main |
| 61 | func main() -> i64 |