nx_force.nx
buildroot/runtime/nx_force.nx
about
nx_force.nx -- 3D force vector primitive. Layer 1 physics
foundation per [[feedback-engineering-sciences-bits-up-3d-print-first]].
Coordinate / unit convention: Q14 Newtons. 1 Q14 unit = 1/16384 N
= 61 µN. Range fits i64 to ±5e14 N = ±5e11 kN -- vastly exceeds
any engineering analysis (largest civil-eng forces are GN scale).
Foundation for downstream primitives queued per the META-CARDINAL
substrate hierarchy:
nx_stress, nx_strain, nx_modulus -- continuum mechanics
nx_fea, nx_finite_element -- structural analysis
nx_pid (already shipped) -- control loop on force
nx_pose, nx_torque -- robotics (force + arm)
nx_aerodynamic_load -- aero/CFD
Composes nx_isqrt (magnitude via Q28 sum-of-squares → Q14 root)
+ nx_i128 + nx_muldiv_i64 (intermediate-overflow protection in
dot/cross products for large magnitudes).
Per Cardinal 6 (no float): all math integer-only. Slicer-class
determinism: same input bytes → same output bytes on every
nxc2 codegen target.
license_tier: ORIGINAL
dependencies 3 imports · 5 importers
imports: nx_syscalls.nxnx_isqrt.nxnx_i128.nx
imported by: nx_acceleration.nxnx_acceleration_test.nxnx_force_test.nxnx_torque.nxnx_torque_test.nx
structs
| 54 | struct NxForce |
consts
| 30 | const NX_FORCE_Q14: i64 = 16384 |
| 37 | const NX_FORCE_GRAVITY_Q14: i64 = 160665 |
| 41 | const NX_FORCE_OK: i64 = 0 |
| 42 | const NX_FORCE_ERR_NULL_INPUT: i64 = 1 |
| 43 | const NX_FORCE_ERR_DEGENERATE: i64 = 2 |
| 60 | const NX_FORCE_BYTES: i64 = 24 |
functions
| 45 | func nx_force_verdict_name(v: i64) -> *u8 called by 1: main |
| 64 | func nx_force_new(fx_q14: i64, fy_q14: i64, fz_q14: i64) -> *NxForce |
| 72 | func nx_force_zero() -> *NxForce |
| 79 | func nx_force_gravity_on_kg(mass_kg_q14: i64) -> *NxForce |
| 87 | func nx_force_add(a: *NxForce, b: *NxForce) -> *NxForce |
| 93 | func nx_force_sub(a: *NxForce, b: *NxForce) -> *NxForce |
| 99 | func nx_force_scale(f: *NxForce, scalar_q14: i64) -> *NxForce |
| 110 | func nx_force_magnitude_q14(f: *NxForce) -> i64 |
| 127 | func nx_force_dot(a: *NxForce, b: *NxForce) -> i64 |
| 139 | func nx_force_cross(a: *NxForce, b: *NxForce) -> *NxForce |