C++17 Core Headers (include/joltsim/)

All native JoltSim headers live under include/joltsim/ in namespace joltsim:


1. include/joltsim/types.hpp

Defines all solver/scene descriptors, enums, and binary-packed sensor structs:

  • SolverConfig: velocity/position iterations, Baumgarte, slop, speculative distance, capacities (max_bodies, max_body_pairs, max_contact_constraints, max_contacts).

  • ContactEvent (alignas(64), 64 bytes) & RayHit (alignas(32), 32 bytes).

  • ShapeType, JointType, MotorMode, SoftBendType, RuntimeConstraintType.

  • MotorConfig, ShapeDesc, BodyDesc, JointDesc, SiteDesc, ArticulationDesc, SoftBodyDesc.

  • SceneBodyMeta, SceneJointMeta, SceneSoftBodyMeta, RuntimeConstraintDesc, ClosestPointResult.


2. include/joltsim/aligned_buffer.hpp

  • template <typename T, std::size_t Alignment = 64> class AlignedBuffer: move-only RAII buffer allocating kAlignment-aligned storage via ::operator new[](..., std::align_val_t, std::nothrow) and zeroing memory on allocate(count).


3. include/joltsim/jolt_context.hpp

  • Broadphase/object layer constants (Layers::NON_MOVING = 0, Layers::MOVING = 1, BroadPhaseLayers::NON_MOVING, BroadPhaseLayers::MOVING).

  • BPLayerInterfaceImpl, ObjectVsBroadPhaseLayerFilterImpl, ObjectLayerPairFilterImpl.

  • void ensure_jolt_initialized(): thread-safe one-time Jolt allocator, factory, and type registration.


4. include/joltsim/articulation.hpp

  • ArticulationJointRuntime: stores Jolt Ref<SixDOFConstraint>, MotorConfig, limits, zero_offset, continuous angle unwrapping state (last_raw_angle, unwrapped_angle), flat buffer offsets (qpos_offset, qvel_offset, ctrl_offset), and mimic joint parameters.

  • ArticulationRuntime: owns link_body_ids, initial transforms, joints, GroupFilterTable, and implements apply_controls(...), read_state(...), and reset(...).


5. include/joltsim/sensors.hpp

  • ContactPairOverride: stores (friction, restitution) overrides keyed by canonical (min(b1, b2), max(b1, b2)) body-index pairs.

  • WorldStepListener (JPH::PhysicsStepListener): calls ArticulationRuntime::apply_controls before each physics substep.

  • WorldContactListener (JPH::ContactListener): records ContactEvent entries into lock-free/atomic buffer slots (up to max_contacts) and applies ContactPairOverride materials in OnContactAdded and OnContactPersisted.


6. include/joltsim/ik.hpp

  • solve_dls_ik(...): damped least-squares inverse kinematics solver over an articulation chain.

  • compute_jacobian(...): computes (6, nv) spatial Jacobian [J_lin; J_ang] at local_point.

  • compute_mass_matrix(...): computes (nv, nv) joint-space inertia matrix \(M(q)\).

  • compute_inverse_dynamics(...): full RNEA computing \(\tau = M(q)\ddot{q} + C(q,\dot{q})\dot{q} + g(q)\) via topological BFS FK, forward velocity/acceleration propagation, and backward wrench recursion.


7. include/joltsim/world.hpp

  • class World: wraps a JPH::PhysicsSystem, TempAllocatorImplWithMallocFallback, and JobSystemThreadPool (or single-threaded). Exposes body/articulation/soft-body/site/constraint creation, step / step_with, dynamics/material/filter mutation, save_state / load_state, save_keyframe / load_keyframe, set_mocap_pose, get_aabb, raycast_batch, proximity queries, FT/IMU sensors, and raw float* buffer accessors.


8. include/joltsim/vec_world.hpp

  • class VecWorld: owns num_envs World instances + persistent std::thread pool (worker_loop), contiguous (N, D) AlignedBuffer state arrays, step, raycast_batch, reset_all, reset_envs, save_state, load_state, save_keyframe, load_keyframe, set_mocap_pose, set_contact_pair_properties, get_aabb, and get_site_pose.