code wiki / (root) / nx_force.nx

nx_force.nx

buildroot/runtime/nx_force.nx

5773 B153 linesdepth 4pulls 5 transitivereach 5 importersview sourcekind library
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_isqrt.nx nx_i128.nx nx_force.nx nx_acceleration.nx nx_acceleration_test.nx nx_force_test.nx nx_torque.nx nx_torque_test.nx

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

54struct NxForce

consts

30const NX_FORCE_Q14: i64 = 16384
37const NX_FORCE_GRAVITY_Q14: i64 = 160665
41const NX_FORCE_OK: i64 = 0
42const NX_FORCE_ERR_NULL_INPUT: i64 = 1
43const NX_FORCE_ERR_DEGENERATE: i64 = 2
60const NX_FORCE_BYTES: i64 = 24

functions

45func nx_force_verdict_name(v: i64) -> *u8
called by 1: main
64func nx_force_new(fx_q14: i64, fy_q14: i64, fz_q14: i64) -> *NxForce
72func nx_force_zero() -> *NxForce
called by 1: main calls 1: nx_force_new
79func nx_force_gravity_on_kg(mass_kg_q14: i64) -> *NxForce
called by 2: mainmain calls 2: nx_muldiv_i64nx_force_new
87func nx_force_add(a: *NxForce, b: *NxForce) -> *NxForce
called by 1: main calls 1: nx_force_new
93func nx_force_sub(a: *NxForce, b: *NxForce) -> *NxForce
called by 1: main calls 1: nx_force_new
99func nx_force_scale(f: *NxForce, scalar_q14: i64) -> *NxForce
called by 1: main calls 2: nx_force_newnx_muldiv_i64
110func nx_force_magnitude_q14(f: *NxForce) -> i64
called by 1: main calls 1: nx_isqrt
127func nx_force_dot(a: *NxForce, b: *NxForce) -> i64
called by 1: main calls 1: nx_muldiv_i64
139func nx_force_cross(a: *NxForce, b: *NxForce) -> *NxForce