code wiki / (root) / nx_itrig.nx

nx_itrig.nx

buildroot/runtime/nx_itrig.nx

1597 B28 linesdepth 0pulls 0 transitivereach 1518 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_itrig.nx -- Provides integer trigonometric functions using 5th-order Taylor series approximations for angles in rad*4096 units. nx_itrig.nx -- SHARED integer trig (extracted from the proven nx_wasm_mineworld implementation per the reuse law: skeleton/animation/robotics/regions all need rotations; nobody re-derives Taylor coefficients). Angle unit = rad*4096 (PI4096=12868, PI2_4096=6434); values fx4096. 5th-order Taylor folded to [-PI/2,PI/2], max error ~0.6% (gate-proven in the mineworld tick gate T0). ALL INTEGER. license_tier: ORIGINAL THE FIXED-POINT UNIT THIS WHOLE LIBRARY IS DEFINED IN -- the fx4096 of the header line above, the same 4096 as in the function names. It arrived here as `IT_MAGIC_4096`, auto-hoisted, wedged BETWEEN the two halves of this file's own header comment, and named after its own value: a name that restates the number is less greppable than the bare literal was, and it told the next reader nothing about what the quantity IS. It is the angle-and-value scale, so it is named for that.

dependencies 0 imports · 75 importers

nx_itrig.nx nx_anatstack.nx nx_articulate_gate.nx nx_assetvariant_gate.nx nx_atmosphere.nx nx_atmsky_gate.nx nx_avatar_splat.nx nx_bodyatlas.nx nx_bvhfk.nx nx_bvhfk_lib.nx nx_craft_before_placement_t316.nx

diagram shows first 10 each side; +0 more imports, +65 more importers in the complete lists below.

imports: none

imported by: nx_anatstack.nxnx_articulate_gate.nxnx_assetvariant_gate.nxnx_atmosphere.nxnx_atmsky_gate.nxnx_avatar_splat.nxnx_bodyatlas.nxnx_bvhfk.nxnx_bvhfk_lib.nxnx_craft_before_placement_t316.nxnx_critic_kernel.nxnx_figure_render.nxnx_fluid.nxnx_gi_path_lib.nxnx_gltf_anim.nxnx_gsplat.nxnx_gsplat_density_gate.nxnx_gsplat_fit_aniso_gate.nxnx_gsplat_gate.nxnx_gsplat_optimize_gate.nxnx_gsplat_perf.nxnx_gsplat_res_gate.nxnx_mesh_view.nxnx_meshpose.nxnx_meshtex.nxnx_movelib.nxnx_movement_base_engine_t139.nxnx_nxa_anim.nxnx_nxa_anim_t30.nxnx_nxa_fk.nxnx_nxa_garment.nxnx_pose_retarget.nxnx_quadruped.nxnx_sdfrender.nxnx_sdfrender_attribution_candidate_t344.nxnx_skeleton.nxnx_skinfam_train_gate.nxnx_skinneural.nxnx_skintex_train_gate.nxnx_swgpu.nxnx_treegen.nxnx_trimesh.nxnx_vecmath.nxnx_vecmath_slerp_candidate_t181.nxnx_wasm_charlab.nxnx_wasm_craft.nxnx_wasm_craft_body_t137.nxnx_wasm_craft_contact_candidate.nxnx_wasm_craft_dunes_t70.nxnx_wasm_craft_gait_candidate.nxnx_wasm_craft_gait_candidate_t139.nxnx_wasm_craft_imported_body_t41.nxnx_wasm_craft_imported_body_t42.nxnx_wasm_craft_imported_body_t49.nxnx_wasm_craft_imported_t262.nxnx_wasm_craft_inspection_bounds_t181.nxnx_wasm_craft_inspection_distance_t218.nxnx_wasm_craft_inspection_t142.nxnx_wasm_craft_journal_index_t21.nxnx_wasm_craft_journal_index_t21_before_t44.nxnx_wasm_craft_lookup_candidate.nxnx_wasm_craft_move_t72.nxnx_wasm_craft_pre_inspection_t142.nxnx_wasm_craft_recovery_t20.nxnx_wasm_craft_relief_adopt_t143.nxnx_wasm_craft_relief_save_t143.nxnx_wasm_craft_relief_t143.nxnx_wasm_craft_residency_t44.nxnx_wasm_craft_turn_candidate_t139.nxnx_wasm_craft_visitors_canonical_t142.nxnx_wasm_craft_visitors_inspection_t142.nxnx_wasm_craft_visitors_t140.nxnx_worldgen.nxnx_worldpipe_core.nxnx_worldpipe_core_relief_t140.nx

structs

none

consts

11const IT_FX: i64 = 4096
12const IT_PI: i64 = 12868
13const IT_PI2: i64 = 6434

functions

15func it_sin4096(a0: i64) -> i64
28func it_cos4096(a: i64) -> i64 { return it_sin4096(a + IT_PI2) }