nx_gcode_extrude_test.nx
buildroot/runtime/nx_gcode_extrude_test.nx
about
nx_gcode_extrude_test.nx -- extrusion math hand-verified against
closed-form physics (volume conservation: mass-in == mass-out for
incompressible deposit).
Reference computation for a 10mm move at standard 0.4mm width +
0.2mm height + 1.75mm filament:
filament_radius = 0.875mm
filament_xsect = π × 0.875² = π × 0.765625 ≈ 2.405 mm²
extruded_volume = 0.4 × 0.2 × 10 = 0.8 mm³
E_delta = 0.8 / 2.405 ≈ 0.3326 mm of filament
In Q14: E_delta ≈ 0.3326 × 16384 ≈ 5451 Q14 units.
Closed-form invariants:
(a) filament_xsect for 1.75mm dia = 2.405mm² ≈ 39408 Q14.
Acceptable tolerance: ±2 Q14 units (rounding in radius+π+r²).
(b) move_length for (0,0)->(10,0) = 10mm = 163840 Q14.
(c) move_length for (0,0)->(0,10) = 10mm = 163840 Q14.
(d) move_length for (3,0)->(0,4) (3-4-5 triangle hypotenuse) = 5mm = 81920 Q14
NOTE: Q14 sqrt has small rounding error; accept ±2.
(e) E_delta for the standard move = ~5451 Q14.
(f) E_delta scales linearly with move length: 20mm move = 2× E_delta of 10mm move.
(g) E_delta is 0 for zero-length move.
(h) Zero filament_xsect returns 0 (defensive, not crash).
expect_exit: 0
license_tier: ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_gcode_extrude.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
| 33 | const Q14: i64 = 16384 |
functions
| 36 | func smoke_near(actual: i64, expected: i64, tol: i64) -> i64 called by 1: main |
| 43 | func main() -> i64 |