code wiki / (root) / nx_csg.nx

nx_csg.nx

buildroot/runtime/nx_csg.nx

10833 B245 linesdepth 5pulls 7 transitivereach 26 importersview sourcekind librarytopic csg
docsdependenciesstructsconstsfunctions

about

nx_csg.nx -- CSG solid -> watertight mesh via marching tetrahedra over an SDF. Samples a two-primitive boolean field (nx_sdf) on a grid, splits every cube into 6 tetrahedra (Kuhn subdivision along the 0-7 diagonal -> shared faces split identically, no cracks), and emits the zero-isosurface. Edge crossings are computed in a CANONICAL endpoint order so a grid edge shared by two tets yields the IDENTICAL point (watertight, the same fix the slicer needed). Triangle winding is forced outward via an inside-reference test. Output is a pipeline- native Q14-mm NxMesh -> flows to nx_stl_write_mesh -> slicer, like every other solid. Robust by construction: SDF booleans never fail the way B-rep does. license_tier: ORIGINAL

dependencies 3 imports · 12 importers

nx_syscalls.nx nx_mesh.nx nx_sdf.nx nx_csg.nx nx_cad_exceed.nx nx_cad_page.nx nx_cad_prims2_test.nx nx_csg_fillet_test.nx nx_csg_scene.nx nx_csg_scene_gate.nx nx_csg_test.nx nx_csg_torus_test.nx nx_vessel_csg.nx nx_vessel_csg_test.nx

diagram shows first 10 each side; +0 more imports, +2 more importers in the complete lists below.

imports: nx_syscalls.nxnx_mesh.nxnx_sdf.nx

imported by: nx_cad_exceed.nxnx_cad_page.nxnx_cad_prims2_test.nxnx_csg_fillet_test.nxnx_csg_scene.nxnx_csg_scene_gate.nxnx_csg_test.nxnx_csg_torus_test.nxnx_vessel_csg.nxnx_vessel_csg_test.nxnx_vessel_emit.nxnx_vessel_gcode.nx

structs

none

consts

none

functions

19func mt_cross(out: *i64, P: *i64, i: i64, j: i64, D: *i64) -> i64
called by 1: mt_tet
40func mt_emit(tribuf: *i64, ntri: *i64, cap: i64, p0: *i64, p1: *i64, p2: *i64,
called by 1: mt_tet
67func mt_tet(tribuf: *i64, ntri: *i64, cap: i64, P: *i64, D: *i64,
107func nx_csg_extract(a: *NxSdfPrim, b: *NxSdfPrim, op: i64,
209func nx_csg_box_minus_cyl(hx: i64, hy: i64, hz: i64, r: i64, res: i64) -> *NxMesh
220func nx_csg_roundbox_mesh(H: i64, r: i64, res: i64) -> *NxMesh
called by 2: mainmain calls 2: nx_sdf_make4nx_csg_extract
228func nx_csg_torus_mesh(R: i64, r: i64, res: i64) -> *NxMesh
called by 2: mainmain calls 2: nx_sdf_makenx_csg_extract
238func nx_csg_two_sphere_fillet(r: i64, sep: i64, k: i64, res: i64) -> *NxMesh