code wiki / (root) / nx_limb_count.nx

nx_limb_count.nx

buildroot/runtime/nx_limb_count.nx

12234 B315 linesdepth 3pulls 3 transitivereach 4 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_limb_count.nx -- Tier 6 anatomical limb-count detector. CAPABILITY_COMPLETENESS: FULL User feedback 2026-05-16 (image #3 thread): "there is no visible nudity as her aerolas and vagina aqre covered but its a weird melty body" -- and earlier: "her pose was odd with her touching a wall." Generative AI produces the "three hands" failure with alarming frequency: a body silhouette with more limbs than anatomy allows. nx_finger_count counts FINGERS within a hand mask. This primitive counts LIMBS attached to a torso. Anatomical norm: 4 (2 arms + 2 legs). Verdict by deviation. Method: Input: torso bbox + N candidate-limb records, each with: - end_x, end_y (the limb's root point -- the end closest to torso, e.g. shoulder for arm, hip for leg) - role hint: ARM / LEG / UNKNOWN (caller-tagged) - bbox For each candidate, check if end-point is INSIDE the torso bbox (with optional padding tolerance). Limbs that attach to torso count. Limbs that DON'T attach are EXTRA / FLOATING. verdict by total-attached: 4 -> OK 5+ -> EXTRA (the "three hands" failure) 3 -> MISSING (occlusion or actual missing limb) 0-2 -> FUSED / SEVERE_OCCLUSION Plus separately track FLOATING limbs (candidates whose root doesn't attach to torso): a single floating limb is the canonical "extra arm floating in space" failure. genealogy_id: substrate_anatomical_limb_count_2026_05_16 lineage_id: tier_6_anatomy_coherence_v1

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_runtime.nx nx_tier.nx nx_limb_count.nx nx_image_grade_v2.nx

imports: nx_syscalls.nxnx_runtime.nxnx_tier.nx

imported by: nx_image_grade_v2.nx

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main sys_mmap _lc_set_candidate nx_limb_count_check sys_mmap ↻ _lc_point_in_bbox

structs

73struct NxLimbCandidate
87struct NxLimbCountResult

consts

45const NX_LIMB_ROLE_UNKNOWN: nx_int = 0
46const NX_LIMB_ROLE_ARM: nx_int = 1
47const NX_LIMB_ROLE_LEG: nx_int = 2
48const NX_LIMB_ROLE_WING: nx_int = 3 // for non-human / dragon / etc.
49const NX_LIMB_ROLE_TAIL: nx_int = 4
50const NX_LIMB_ROLE_N_KINDS: nx_int = 5
54const NX_LC_VERDICT_OK: nx_int = 0
55const NX_LC_VERDICT_EXTRA: nx_int = 1
56const NX_LC_VERDICT_MISSING: nx_int = 2
57const NX_LC_VERDICT_FUSED: nx_int = 3
58const NX_LC_VERDICT_FLOATING_LIMB: nx_int = 4
59const NX_LC_VERDICT_WRONG_ARM_LEG_RATIO: nx_int = 5
63const NX_LC_MAX_LIMBS: nx_int = 32
64const NX_LC_DEFAULT_PADDING: nx_int = 8 // pixels around torso bbox
67const NX_LC_HUMAN_ARMS: nx_int = 2
68const NX_LC_HUMAN_LEGS: nx_int = 2
69const NX_LC_HUMAN_TOTAL: nx_int = 4
83const NX_LIMB_CANDIDATE_BYTES: nx_size = 56
98const NX_LC_RESULT_BYTES: nx_size = 64

functions

102func _lc_point_in_bbox(x: nx_int, y: nx_int,
called by 1: nx_limb_count_check
114func nx_limb_count_check(
201func _lc_set_candidate(arr: *NxLimbCandidate, idx: nx_int,
called by 1: main
215func main() -> nx_int