nx_limb_count.nx
buildroot/runtime/nx_limb_count.nx
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
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
structs
| 73 | struct NxLimbCandidate |
| 87 | struct NxLimbCountResult |
consts
| 45 | const NX_LIMB_ROLE_UNKNOWN: nx_int = 0 |
| 46 | const NX_LIMB_ROLE_ARM: nx_int = 1 |
| 47 | const NX_LIMB_ROLE_LEG: nx_int = 2 |
| 48 | const NX_LIMB_ROLE_WING: nx_int = 3 // for non-human / dragon / etc. |
| 49 | const NX_LIMB_ROLE_TAIL: nx_int = 4 |
| 50 | const NX_LIMB_ROLE_N_KINDS: nx_int = 5 |
| 54 | const NX_LC_VERDICT_OK: nx_int = 0 |
| 55 | const NX_LC_VERDICT_EXTRA: nx_int = 1 |
| 56 | const NX_LC_VERDICT_MISSING: nx_int = 2 |
| 57 | const NX_LC_VERDICT_FUSED: nx_int = 3 |
| 58 | const NX_LC_VERDICT_FLOATING_LIMB: nx_int = 4 |
| 59 | const NX_LC_VERDICT_WRONG_ARM_LEG_RATIO: nx_int = 5 |
| 63 | const NX_LC_MAX_LIMBS: nx_int = 32 |
| 64 | const NX_LC_DEFAULT_PADDING: nx_int = 8 // pixels around torso bbox |
| 67 | const NX_LC_HUMAN_ARMS: nx_int = 2 |
| 68 | const NX_LC_HUMAN_LEGS: nx_int = 2 |
| 69 | const NX_LC_HUMAN_TOTAL: nx_int = 4 |
| 83 | const NX_LIMB_CANDIDATE_BYTES: nx_size = 56 |
| 98 | const NX_LC_RESULT_BYTES: nx_size = 64 |
functions
| 102 | func _lc_point_in_bbox(x: nx_int, y: nx_int, called by 1: nx_limb_count_check |
| 114 | func nx_limb_count_check( |
| 201 | func _lc_set_candidate(arr: *NxLimbCandidate, idx: nx_int, called by 1: main |
| 215 | func main() -> nx_int |