nx_torque_test.nx
buildroot/runtime/nx_torque_test.nx
about
nx_torque_test.nx -- torque vector ops + cross-primitive
composition demo with nx_force.
Closed-form invariants (Q14 N·m unless noted):
(a) Zero torque magnitude = 0.
(b) Unit +Z torque magnitude = Q14.
(c) (3, 4, 0) Q14 N·m -> magnitude 5 Q14 (3-4-5).
(d) Add: (1, 2, 3) + (4, 5, 6) = (5, 7, 9).
(e) τ = r × F demo: r = (1, 0, 0) m, F = (0, 1, 0) N
→ τ = +Z 1 N·m (right-hand rule).
(f) τ = r × F: r = (0, 2, 0) m, F = (3, 0, 0) N
→ τ = (0*0 - 0*0, 0*3 - 0*0, 2*0 - 0*3 - oh wait
Let me recompute by formula:
τ_x = r_y*F_z - r_z*F_y = 2*0 - 0*0 = 0
τ_y = r_z*F_x - r_x*F_z = 0*3 - 0*0 = 0
τ_z = r_x*F_y - r_y*F_x = 0*0 - 2*3 = -6
→ (0, 0, -6) Q14 N·m
(g) τ from r=0, F=anything → zero torque (no lever arm).
(h) Verdict name lookup non-NULL for every verdict.
expect_exit: 0
license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_force.nxnx_torque.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
| 33 | const Q14: i64 = 16384 |
functions
| 35 | func near(actual: i64, expected: i64, tol: i64) -> i64 called by 1: main |
| 42 | func main() -> i64 |