code wiki / (root) / nx_bvh_test.nx

nx_bvh_test.nx

buildroot/runtime/nx_bvh_test.nx

2887 B82 linesdepth 7pulls 7 transitivereach 0 importersview sourcekind gate/proof
docsdependenciesstructsconstsfunctions

about

nx_bvh_test.nx -- exercise BVH build on tetrahedron mesh in both single-leaf and forced-multi-node configurations. Closed-form invariants: (a) Default-threshold build on tetrahedron (4 tris, threshold=4) yields exactly 1 node (a single leaf with count=4). (b) Root AABB matches mesh bbox: (0,0,0) to (EDGE,EDGE,EDGE). (c) Sum of leaf counts == n_tris. (d) leaf_threshold=2 forces the tetrahedron to split, producing >= 3 nodes (1 internal + 2 leaves minimum) and a tree where sum of leaf counts is still 4. (e) Internal node's right child index == left + 1 (depth-first sibling-adjacency invariant). (f) Empty mesh degenerate: n_tris=0 returns BVH with n_tris=0. expect_exit: 0 license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_mesh.nx nx_mesh_print_check.nx nx_bvh.nx nx_bvh_test.nx

imports: nx_syscalls.nxnx_mesh.nxnx_mesh_print_check.nxnx_bvh.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_bvh_node_at ↻ nx_bvh_total_leaf_count nx_bvh_node_at ↻ nx_bvh_leaf_node_count nx_bvh_node_at ↻ nx_bvh_build_with_threshol ↻ nx_mesh_alloc ↻

structs

none

consts

24const EDGE_Q14: i64 = 16384

functions

26func main() -> i64