code wiki / _hdl_build / nx_fitloop.nx
nx_fitloop.nx
buildroot/runtime/_hdl_build/nx_fitloop.nx
about
nx_fitloop.nx -- THE KEYSTONE: METROLOGY IN THE AUTHORING LOOP (debt 1785967773; operator 2026-08-05:
crafting and measuring must grow each other). A generator is driven by a judge in a CLOSED LOOP with
an auditable trial trace -- the capability this session proved manually (hand 241->358->258->191->181mm
across five hand-run pose trials) and the gap measured in the industry: authoring tools have no
metrology in the loop, metrology tools do not author.
v1 searches the 2-parameter pose space measured tonight: symmetric shoulder raise s and elbow raise e
(degrees, clamped 0..90; left rows get -deg, right +deg; elbow pivot approximation declared valid for
small s). Generator = nx_meshpose apply. Judge = nx_meshdist parts; OBJECTIVE = the SUM of all per-part
mean distances (pose moves only arms, torso terms are constant, so minimising the sum minimises the
arm gap without wrecking anything else -- and a whole-body objective cannot be gamed by improving one
part at another's expense).
u2605THE VACUOUS-OBJECTIVE GUARD IS THE ORGAN'S FIRST TOOTH: a failed judge run yields an empty capture
whose sum is 0 = "perfect". Any trial parsing fewer than 10 part rows is INVALID and scores WORST,
never best -- an optimiser that can reward a broken ruler will find the broken ruler immediately.
nx_fitloop pose2 <base.nxmesh> <oracle_parts.nxmesh> <out_best.nxmesh> [budget]
nx_fitloop selftest
Trial trace: one TRIAL row per evaluation (s, e, objective um-sum, parts parsed) -- the optimisation
is EVIDENCE, not a black box. license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_tool_run.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 24 | const FL_MAGIC_4096: i64 = 4096 |
| 26 | const FL_CAP: i64 = 262144 |
| 27 | const FL_MAXTRIAL: i64 = 40 |
| 28 | const FL_BAD: i64 = 4611686018427387903 |
| 29 | const FL_MINPARTS: i64 = 10 |
functions
| 31 | func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 32 | func pn(v: i64) -> i64 { let b: *u8=sys_mmap(32) as *u8; var x: i64=v; var ng: i64=0; if x<0{ng=1;x=0-x} var i: i64=31; if x==0{b[i]=48 as u8;i=i-1} while x>0{b[i]=(48+x%10) as u8;x=x/10;i=i-1} if ng==1{b[i]=45 as u8;i=i-1} sys_write(1,(b as i64+i+1) as *u8,31-i); return 0 } |
| 33 | func fl_refuse(reason: *u8) -> i64 { hw("FITLOOP REFUSED: " as *u8); hw(reason); hw("\n" as *u8); return 0 } |
| 34 | func fl_cat(b: *u8, off: i64, s: *u8) -> i64 called by 1: fl_posefile |
| 40 | func fl_int(b: *u8, off: i64, v: i64) -> i64 |
| 51 | func fl_wrfile(path: *u8, b: *u8, n: i64) -> i64 |
| 58 | func fl_exists(path: *u8) -> i64 |
| 65 | func fl_objective(cap: *u8, n: i64, cnt: *i64) -> i64 |
| 95 | func fl_posefile(path: *u8, s: i64, e: i64) -> i64 |
| 110 | func fl_trial(base: *u8, oracle: *u8, s: i64, e: i64, nparts: *i64) -> i64 |
| 142 | func fl_pose2(base: *u8, oracle: *u8, outp: *u8, budget: i64) -> i64 |
| 210 | func fl_selftest() -> i64 |
| 229 | func main(argc: i64, argv: *i64) -> i64 |