code wiki / (root) / nx_vasc_lib.nx

nx_vasc_lib.nx

buildroot/runtime/nx_vasc_lib.nx

3967 B68 linesdepth 3pulls 5 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_vasc_lib.nx -- GROWN VASCULATURE -> THE HAEMOGLOBIN FIELD THE SKIN LAYER SEES (2026-09-03) THE OPERATOR'S LAW THIS IMPLEMENTS (2026-09-03): a human is GROWN bottom-up -- bone, nerve, circulation, muscle, fat, dermis, hair out of follicles -- and the vessels you can see through fair skin must EMERGE from a circulatory structure that is actually there. Painting a blue line on a texture is the failure mode this file exists to make unnecessary. THE JOIN. The estate already grows: nx_derm computes skin as an envelope FROM the layers beneath it, nx_anat_sov carries inside-out vasculature scoped to where it actually shows (chest, hands, not everywhere), nx_nxa_groom grows hair from a follicle-density RATIO. What was missing is the step between a grown vessel network and a VISIBLE colour: geometry has no appearance until something converts it into an absorber concentration. That is this file. It takes segments of a grown network -- each with a volume fraction and a depth below the surface -- and returns the haemoglobin fraction c_hem that nx_kubelka_lib's mix term consumes. Structure in, chromophore out; Kubelka-Munk then turns chromophore into reflectance. BEER-LAMBERT, DOUBLE PASS. Light must cross the tissue above a vessel, scatter, and cross it again to be seen, so a segment's visible contribution falls as exp(-2*atten*depth). A vessel one millimetre down contributes far less than the same vessel just under the surface, which is exactly why vasculature reads on the wrist and the eyelid and not on the palm. WHAT THIS FILE DELIBERATELY DOES NOT MODEL: epidermal MELANIN attenuation. Melanin is already an absorber in km_ks_mix, and attenuating the vessel signal by melanin here as well would COUNT IT TWICE -- the same absorber charged on two layers, which reads as a plausible darkening and is a physics error. The melanin term belongs to Kubelka-Munk alone. IT ACCEPTS A NETWORK, IT DOES NOT INVENT ONE. Branching growth is its own rung with its own gate; this lib is the join and takes the grown segments as input, so no growth model is faked here. PROVEN 9/9 GREEN 2026-09-03. The two teeth that matter: denser vasculature raises the red-minus-green separation from 89,090 to 196,295 micro (the skin reddens BECAUSE the vessels are there), and the same vessel buried deep returns that separation to 70,497 -- byte-identical to the vessel-free baseline. license_tier: ORIGINAL No hw writes (Rule 26). LIB (no main).

dependencies 2 imports · 1 importers

nx_syscalls.nx nx_fixq30_lib.nx nx_vasc_lib.nx nx_vasc_gate.nx

imports: nx_syscalls.nxnx_fixq30_lib.nx

imported by: nx_vasc_gate.nx

structs

none

consts

36const VA_REFUSED: i64 = 0 - 1
37const VA_TWO: i64 = 2

functions

43func va_seg_visible(fq: *i64, vol: i64, depth: i64, atten: i64) -> i64
called by 2: mainva_field calls 2: fq_mulfq_exp
55func va_field(fq: *i64, vols: *i64, depths: *i64, n: i64, atten: i64) -> i64
called by 1: main calls 1: va_seg_visible