code wiki / (root) / nx_supports_test.nx

nx_supports_test.nx

buildroot/runtime/nx_supports_test.nx

3666 B89 linesdepth 11pulls 26 transitivereach 0 importersview sourcekind gate/prooftopic supports
docsdependenciesstructsconstsfunctions

about

nx_supports_test.nx -- overhang detection on hand-built layer pairs with closed-form expected counts. Test polygons (CCW unit squares + variants): sq1 = unit square (0,0)-(Q14,Q14) sq_big = bigger square (-Q14,-Q14)-(2*Q14,2*Q14) -- "mushroom" on top of unit square sq_inside = smaller (Q14/4, Q14/4)-(3*Q14/4, 3*Q14/4) -- entirely within sq1 (supported) Closed-form invariants: (a) First layer (prev=NULL): no overhang reported regardless of cur polygon. (b) Stacked same-size squares: 0 overhang (cur completely inside prev expanded by any positive tolerance). (c) Larger square on smaller: all 4 corners of cur are outside prev's envelope -> 4 overhang points. (d) Smaller square inside larger: 0 overhang. (e) Bad input (cur n_verts < 3): BAD_INPUT verdict. (f) NULL out param: BAD_INPUT verdict. (g) Overhang tolerance 0 still works (uses prev as envelope directly, no offset). expect_exit: 0 license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_polygon.nx nx_supports.nx nx_supports_test.nx

imports: nx_syscalls.nxnx_polygon.nxnx_supports.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main nx_polygon_make_square nx_polygon_alloc sys_mmap nx_polygon_add_vert nx_polygon_set_vert nx_polygon_vert_ptr nx_supports_new sys_mmap ↻ nx_supports_layer_overhang nx_polygon_offset nx_polygon_alloc ↻ nx_polygon_get_x nx_polygon_vert_ptr ↻ nx_polygon_get_y nx_polygon_vert_ptr ↻ nx_isqrt nx_muldiv_i64 nx_i128_alloc nx_i128_mul_i64 nx_i128_mul_u64 nx_i128_neg nx_i128_div_i64 nx_i128_is_neg nx_i128_neg ↻ nx_i128_udiv_u64 nx_polygon_set_vert ↻ nx_polygon_get_x ↻ nx_polygon_get_y ↻ nx_polygon_point_inside nx_polygon_get_x ↻ nx_polygon_get_y ↻ nx_supports_add nx_polygon_alloc ↻ nx_polygon_add_vert ↻

structs

none

consts

31const Q14: i64 = 16384

functions

33func main() -> i64