code wiki / (root) / nx_mesh_print_check.nx

nx_mesh_print_check.nx

buildroot/runtime/nx_mesh_print_check.nx

6643 B171 linesdepth 5pulls 5 transitivereach 72 importersview sourcekind librarytopic mesh
docsdependenciesstructsconstsfunctions

about

nx_mesh_print_check.nx -- printability checks on the L1 canonical NxMesh (defined in nx_mesh.nx). Adds: - axis-aligned bounding box computation - watertight / 2-manifold edge check - tetrahedron factory (smallest non-degenerate closed mesh, for smokes and calibration tests) Composes nx_mesh.nx -- does NOT modify the L1 container. Per cardinal feedback-DRY-through-shared-libraries: extend at the primitive boundary, do not fork the canonical mesh. Why split from nx_mesh.nx: nx_mesh is the canonical L1 graphics primitive (used by nx_raster, nx_voxel_mesh, nx_render_pass). Manifold / bbox / printability are FDM-print-specific predicates. Keeping them in a sibling primitive prevents graphics callers from pulling print-only dependencies. Per cardinal NISHI_3D_PRINT_ROADMAP §2.1+2.2: a watertight, closed manifold mesh is a hard precondition for any slicer that claims to EXCEED OrcaSlicer's tree-support / adaptive-Z handling. Non-manifold meshes cascade into ambiguous slice contours. Detect at the boundary (Cardinal 12), not deep in the slicer. Coordinate convention: inherits nx_mesh's Q14 fixed-point xyz. 1 Q14 unit = 1/16384. Tetrahedron factory takes a unit-edge length and scales to Q14 internally. Manifold check algorithm (O(t²) for P0.1): In a watertight orientable 2-manifold, every undirected edge appears in EXACTLY two triangles, with opposite winding (one sees a->b, the other sees b->a). For each directed edge emitted by triangle T, find the reverse-direction edge in some OTHER triangle. Reverse count must equal 1 for every directed edge. O(t²) is fine for P0.1 smokes (tetrahedron = 4 tris); P0.2 swaps in a hashed-edge O(t) impl for the Christus (~200K tris). license_tier: ORIGINAL

dependencies 2 imports · 29 importers

nx_syscalls.nx nx_mesh.nx nx_mesh_print_check.nx nx_bvh.nx nx_bvh_test.nx nx_csg_rot_gate.nx nx_csg_rotxz_gate.nx nx_estimate.nx nx_mesh_decimate.nx nx_mesh_decimate_gate.nx nx_mesh_print_check_test.nx nx_mesh_qem.nx nx_mesh_qem_gate.nx

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

imports: nx_syscalls.nxnx_mesh.nx

imported by: nx_bvh.nxnx_bvh_test.nxnx_csg_rot_gate.nxnx_csg_rotxz_gate.nxnx_estimate.nxnx_mesh_decimate.nxnx_mesh_decimate_gate.nxnx_mesh_print_check_test.nxnx_mesh_qem.nxnx_mesh_qem_gate.nxnx_preflight.nxnx_preflight_test.nxnx_print_e2e_gate.nxnx_print_e2e_test.nxnx_slice_auto_supports.nxnx_slice_contour_test.nxnx_slice_pipe_v2_real_test.nxnx_slice_pipeline.nxnx_slice_pipeline_test.nxnx_slice_plane.nxnx_slice_plane_test.nxnx_stl_test.nxnx_underridge_cleaner_gate.nxnx_underridge_gcode_gate.nxnx_underridge_gel_gate.nxnx_underridge_hook_gate.nxnx_underridge_hook_gcode_gate.nxnx_underridge_hook_petg_gate.nxnx_underridge_master_gate.nx

structs

46struct NxMeshBBox

consts

52const NX_MESH_BBOX_BYTES: i64 = 56
86const NX_MESH_PRINT_OK: i64 = 0
87const NX_MESH_PRINT_ERR_NOT_MANIFOLD: i64 = 1
88const NX_MESH_PRINT_ERR_NONE_TRIS: i64 = 2

functions

54func nx_mesh_bbox_compute(m: *NxMesh) -> *NxMeshBBox
91func nx_mesh_print_tri_v(m: *NxMesh, ti: nx_int, k: i64) -> i64
97func nx_mesh_print_dir_edge_count(m: *NxMesh, va: i64, vb: i64, exclude_tri: nx_int) -> i64
116func nx_mesh_is_manifold(m: *NxMesh) -> i64
157func nx_mesh_make_tetrahedron(edge_q14: i64, color: i64) -> *NxMesh