code wiki / (root) / nx_garment_fit_match.nx

nx_garment_fit_match.nx

buildroot/runtime/nx_garment_fit_match.nx

14285 B339 linesdepth 2pulls 2 transitivereach 5 importersview sourcekind librarytopic garment
docsdependenciesstructsconstsfunctions

about

nx_garment_fit_match.nx -- real-measurement garment-vs-body fit verdict. BUSINESS PROBLEM (user 2026-05-15 background): the apparel industry has ZERO size-label uniformity. "Small" at Brand A is different from "Small" at Brand B. A consumer buys "size Small" thinking she knows what she's getting and ends up with a dress that doesn't fit AND/OR doesn't flatter her body type even when it physically fits. Returns + dissatisfaction are the cost. SUBSTRATE-NATIVE FIX: measure the actual garment (from photo via landmark + reference-scale; that primitive is queued). Match to the customer's body measurements. Emit a substrate-honest verdict: PERFECT_TAILORED within +-5mm on every axis (couture-fit band) GOOD_FIT within +-25mm; typical tailoring tolerance LOOSE_OK larger than ideal but wearable TIGHT_OK smaller than ideal but wearable SIZED_WRONG >50mm off on a critical axis (bust/waist/hip) UNFLATTERING fits physically but the garment's silhouette accentuates wrong axes for this body archetype (e.g., a sheath dress on a pear-archetype body emphasizes hip-bust ratio in a way the customer typically doesn't want) The substrate refuses to silently rate "fits" as "good"; UNFLATTERING is its own verdict so the retailer can offer the customer the option to ship anyway OR see an alternative cut. Recommended-size action sealed enum: SHIP / SIZE_DOWN / SIZE_UP / TRY_DIFFERENT_CUT / TAILOR_TO_FIT LOSSLESS VS LOSSY: this primitive replaces "Small" (a 3-letter label that maps to ~10cm of bust width variance across brands) with "32-26-34 / 165cm / your bust delta = +3mm / verdict GOOD_FIT". Every claim is measurable + queryable. The retail competitive edge the user named. USE CASES: - retail product page: customer enters her measurements; substrate scores every SKU in inventory + ranks by fit_score

dependencies 2 imports · 5 importers

nx_syscalls.nx nx_tier.nx nx_garment_fit_match.nx nx_body_measurement_extract.nx nx_body_measurement_extract_test.n nx_garment_extract_measurements.nx nx_garment_extract_measurements_te nx_garment_fit_match_test.nx

imports: nx_syscalls.nxnx_tier.nx

imported by: nx_body_measurement_extract.nxnx_body_measurement_extract_test.nxnx_garment_extract_measurements.nxnx_garment_extract_measurements_test.nxnx_garment_fit_match_test.nx

structs

117struct GarmentDimensions
129struct BodyDimensions
140struct FitMatchReport

consts

65const NX_FIT_Q: nx_int = 1024
69const NX_FIT_SIZED_WRONG: nx_int = 0
70const NX_FIT_UNFLATTERING: nx_int = 1
71const NX_FIT_TIGHT_OK: nx_int = 2
72const NX_FIT_LOOSE_OK: nx_int = 3
73const NX_FIT_GOOD_FIT: nx_int = 4
74const NX_FIT_PERFECT_TAILORED: nx_int = 5
75const NX_FIT_N_VERDICTS: nx_int = 6
78const NX_FIT_ACTION_SHIP: nx_int = 0
79const NX_FIT_ACTION_SIZE_DOWN: nx_int = 1
80const NX_FIT_ACTION_SIZE_UP: nx_int = 2
81const NX_FIT_ACTION_TRY_DIFFERENT_CUT: nx_int = 3
82const NX_FIT_ACTION_TAILOR_TO_FIT: nx_int = 4
83const NX_FIT_N_ACTIONS: nx_int = 5
89const NX_FIT_PERFECT_TOL_MM: nx_int = 5 // tailored / couture
90const NX_FIT_GOOD_TOL_MM: nx_int = 25 // typical tailoring
91const NX_FIT_LOOSE_TOL_MM: nx_int = 50 // outer wearable
92const NX_FIT_SIZED_WRONG_MM: nx_int = 75 // beyond, not wearable
97const NX_FIT_ARCHETYPE_UNKNOWN: nx_int = 0
98const NX_FIT_ARCHETYPE_SLIM: nx_int = 1
99const NX_FIT_ARCHETYPE_ATHLETIC: nx_int = 2
100const NX_FIT_ARCHETYPE_AVERAGE: nx_int = 3
101const NX_FIT_ARCHETYPE_CURVY: nx_int = 4
102const NX_FIT_ARCHETYPE_FULL: nx_int = 5
103const NX_FIT_ARCHETYPE_VOLUPTUOUS: nx_int = 6
104const NX_FIT_ARCHETYPE_MUSCULAR: nx_int = 7
105const NX_FIT_ARCHETYPE_PETITE: nx_int = 8
108const NX_FIT_CUT_UNKNOWN: nx_int = 0
109const NX_FIT_CUT_SHEATH: nx_int = 1 // hugs all axes; unforgiving
110const NX_FIT_CUT_A_LINE: nx_int = 2 // flares at hip; hides hip
111const NX_FIT_CUT_EMPIRE_WAIST: nx_int = 3 // hides waist + accentuates bust
112const NX_FIT_CUT_WRAP: nx_int = 4 // emphasizes waist; flatters curvy
113const NX_FIT_CUT_BODYCON: nx_int = 5 // hugs everything; demands smoothness
114const NX_FIT_CUT_SHIFT: nx_int = 6 // boxy; hides waist; flatters athletic
115const NX_FIT_CUT_FIT_AND_FLARE: nx_int = 7 // emphasizes waist + softens hip

functions

159func _fit_abs(x: nx_int) -> nx_int
171func _fit_flattery_seed(cut: nx_int, archetype: nx_int) -> nx_int
219func nx_garment_fit_match(
329func nx_garment_fit_verdict_is_valid(v: nx_int) -> nx_int
called by 1: main
335func nx_garment_fit_action_is_valid(a: nx_int) -> nx_int
called by 1: main