code wiki / (root) / nx_slice_contour_test.nx

nx_slice_contour_test.nx

buildroot/runtime/nx_slice_contour_test.nx

2271 B73 linesdepth 9pulls 13 transitivereach 0 importersview sourcekind gate/prooftopic slice
docsdependenciesstructsconstsfunctions

about

nx_slice_contour_test.nx -- end-to-end: tetrahedron mesh -> BVH -> slice at midplane -> contour assembly. Verifies the 3 segments produced by nx_slice_plane_smoke get linked into exactly 1 closed polygon (the right triangle at z=0.5mm). Closed-form invariants: (a) Contours verdict == OK (every contour closed). (b) Exactly 1 polygon emitted. (c) n_open == 0. (d) Polygon has exactly 3 vertices (= 3 segments forming a closed triangle). (e) The vertex set equals {(0,0), (8192,0), (0,8192)} (any cyclic order accepted). (f) Polygon is well-formed: nx_polygon_signed_2area_q28 != 0 (non-degenerate triangle). expect_exit: 0 license_tier: ORIGINAL

dependencies 7 imports · 0 importers

nx_syscalls.nx nx_mesh.nx nx_mesh_print_check.nx nx_bvh.nx nx_slice_plane.nx nx_polygon.nx nx_slice_contour.nx nx_slice_contour_test.nx

imports: nx_syscalls.nxnx_mesh.nxnx_mesh_print_check.nxnx_bvh.nxnx_slice_plane.nxnx_polygon.nxnx_slice_contour.nx

imported by: nobody (leaf or entry point)

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

main nx_mesh_make_tetrahedron nx_mesh_alloc sys_mmap nx_mesh_set_vertex nx_mesh_set_triangle nx_bvh_build nx_bvh_build_with_threshol sys_mmap ↻ nx_bvh_compute_tri_info nx_mesh_print_tri_v nx_mesh_get_vertex_x nx_mesh_get_vertex_y nx_mesh_get_vertex_z nx_bvh_tri_at nx_bvh_min3 nx_bvh_max3 nx_bvh_build_subtree nx_bvh_alloc_node nx_bvh_fill_subtree nx_bvh_node_at nx_bvh_range_aabb nx_bvh_tri_at ↻ nx_bvh_longest_axis nx_bvh_partition_by_axis nx_bvh_centroid_on_axis nx_bvh_swap_tri_order nx_bvh_alloc_node ↻ nx_bvh_fill_subtree ↻ nx_slice_plane nx_slice_soup_new sys_mmap ↻ nx_slice_walk_node nx_bvh_node_at ↻ nx_slice_one_tri nx_mesh_print_tri_v ↻ nx_mesh_get_vertex_x ↻ nx_mesh_get_vertex_y ↻ nx_mesh_get_vertex_z ↻ nx_slice_soup_emit

structs

none

consts

28const Q14_ONE: i64 = 16384
29const Q14_HALF: i64 = 8192

functions

32func smoke_has_vert(p: *NxPolygon, x: i64, y: i64) -> i64
43func main() -> i64