code wiki / (root) / nx_meshthick.nx

nx_meshthick.nx

buildroot/runtime/nx_meshthick.nx

6811 B160 linesdepth 3pulls 4 transitivereach 9 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_meshthick.nx -- R5 of the CAD car-twin ladder (cadtwin P6a): MESH WALL-THICKNESS by ray-casting (the GOM/ZEISS-INSPECT "ray method"), the GEOMETRIC half of "identify underbuilt parts when flipping cars" (R6 nx_underbuilt_board is the DATA half). For each triangle face: from its centroid, cast a ray along the INWARD normal and find the nearest OTHER face -> that hit distance is the local wall thickness. The MIN over all faces = the thinnest wall = the underbuilt candidate. A data-driven THRESHOLD (passed in, never hardcoded) classifies a part OK vs UNDERBUILT. All fixed-point fx256 (256 = 1.0), deterministic. Composes nx_mesh3 (real tri-mesh + STL interchange). Ray-triangle = Moller-Trumbore, KAT-gated. license_tier: ORIGINAL

dependencies 1 imports · 2 importers

nx_mesh3.nx nx_meshthick.nx nx_meshseg3d.nx nx_meshthick_gate.nx

imports: nx_mesh3.nx

imported by: nx_meshseg3d.nxnx_meshthick_gate.nx

structs

none

consts

10const MTK_ONE: i64 = 256 // 1.0 in fx256
11const MTK_EPS: i64 = 64 // 0.25 real: skip self/coplanar hits (t must exceed this)
12const MTK_BIG: i64 = 4611686018427387904 // "no hit" sentinel thickness

functions

14func mtk_fxmul(a: i64, b: i64) -> i64 { return (a * b) / MTK_ONE }
called by 1: mtk_ray_tri
15func mtk_fxdiv(a: i64, b: i64) -> i64 { if b == 0 { return 0 } return (a * MTK_ONE) / b }
called by 1: mtk_ray_tri
16func mtk_abs(a: i64) -> i64 { if a < 0 { return 0 - a } return a }
called by 2: mtk_ray_trimain
19func mtk_isqrt(n: i64) -> i64
called by 1: mtk_face_normal
29func mtk_ray_tri(ox: i64, oy: i64, oz: i64, dx: i64, dy: i64, dz: i64,
70func mtk_cast(base: i64, ox: i64, oy: i64, oz: i64, dx: i64, dy: i64, dz: i64, skip_tri: i64) -> i64
92func mtk_face_normal(base: i64, ti: i64, out3: *i64) -> i64
115func mtk_centroid(base: i64, ti: i64, out3: *i64) -> i64
called by 1: mtk_face_thickness calls 2: m3_trim3_vert
127func mtk_face_thickness(base: i64, ti: i64) -> i64
140func mtk_min_thickness(base: i64, out_face: *i64) -> i64
called by 1: main calls 2: m3_hdrmtk_face_thickness
156func mtk_is_underbuilt(min_thick: i64, threshold_fx: i64) -> i64
called by 1: main