nx_garment_fit_match.nx
buildroot/runtime/nx_garment_fit_match.nx
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
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
| 117 | struct GarmentDimensions |
| 129 | struct BodyDimensions |
| 140 | struct FitMatchReport |
consts
| 65 | const NX_FIT_Q: nx_int = 1024 |
| 69 | const NX_FIT_SIZED_WRONG: nx_int = 0 |
| 70 | const NX_FIT_UNFLATTERING: nx_int = 1 |
| 71 | const NX_FIT_TIGHT_OK: nx_int = 2 |
| 72 | const NX_FIT_LOOSE_OK: nx_int = 3 |
| 73 | const NX_FIT_GOOD_FIT: nx_int = 4 |
| 74 | const NX_FIT_PERFECT_TAILORED: nx_int = 5 |
| 75 | const NX_FIT_N_VERDICTS: nx_int = 6 |
| 78 | const NX_FIT_ACTION_SHIP: nx_int = 0 |
| 79 | const NX_FIT_ACTION_SIZE_DOWN: nx_int = 1 |
| 80 | const NX_FIT_ACTION_SIZE_UP: nx_int = 2 |
| 81 | const NX_FIT_ACTION_TRY_DIFFERENT_CUT: nx_int = 3 |
| 82 | const NX_FIT_ACTION_TAILOR_TO_FIT: nx_int = 4 |
| 83 | const NX_FIT_N_ACTIONS: nx_int = 5 |
| 89 | const NX_FIT_PERFECT_TOL_MM: nx_int = 5 // tailored / couture |
| 90 | const NX_FIT_GOOD_TOL_MM: nx_int = 25 // typical tailoring |
| 91 | const NX_FIT_LOOSE_TOL_MM: nx_int = 50 // outer wearable |
| 92 | const NX_FIT_SIZED_WRONG_MM: nx_int = 75 // beyond, not wearable |
| 97 | const NX_FIT_ARCHETYPE_UNKNOWN: nx_int = 0 |
| 98 | const NX_FIT_ARCHETYPE_SLIM: nx_int = 1 |
| 99 | const NX_FIT_ARCHETYPE_ATHLETIC: nx_int = 2 |
| 100 | const NX_FIT_ARCHETYPE_AVERAGE: nx_int = 3 |
| 101 | const NX_FIT_ARCHETYPE_CURVY: nx_int = 4 |
| 102 | const NX_FIT_ARCHETYPE_FULL: nx_int = 5 |
| 103 | const NX_FIT_ARCHETYPE_VOLUPTUOUS: nx_int = 6 |
| 104 | const NX_FIT_ARCHETYPE_MUSCULAR: nx_int = 7 |
| 105 | const NX_FIT_ARCHETYPE_PETITE: nx_int = 8 |
| 108 | const NX_FIT_CUT_UNKNOWN: nx_int = 0 |
| 109 | const NX_FIT_CUT_SHEATH: nx_int = 1 // hugs all axes; unforgiving |
| 110 | const NX_FIT_CUT_A_LINE: nx_int = 2 // flares at hip; hides hip |
| 111 | const NX_FIT_CUT_EMPIRE_WAIST: nx_int = 3 // hides waist + accentuates bust |
| 112 | const NX_FIT_CUT_WRAP: nx_int = 4 // emphasizes waist; flatters curvy |
| 113 | const NX_FIT_CUT_BODYCON: nx_int = 5 // hugs everything; demands smoothness |
| 114 | const NX_FIT_CUT_SHIFT: nx_int = 6 // boxy; hides waist; flatters athletic |
| 115 | const NX_FIT_CUT_FIT_AND_FLARE: nx_int = 7 // emphasizes waist + softens hip |
functions
| 159 | func _fit_abs(x: nx_int) -> nx_int called by 1: nx_garment_fit_match |
| 171 | func _fit_flattery_seed(cut: nx_int, archetype: nx_int) -> nx_int called by 1: nx_garment_fit_match |
| 219 | func nx_garment_fit_match( |
| 329 | func nx_garment_fit_verdict_is_valid(v: nx_int) -> nx_int called by 1: main |
| 335 | func nx_garment_fit_action_is_valid(a: nx_int) -> nx_int called by 1: main |