- Create soi_transition.toml with Sun + Mars + SmallBody (3 bodies)
- Add test_soi_transition.cpp with 2 test cases:
* SOI transition from Sun to Mars (validates one-way transition)
* SOI radii calculation verification
- Use comet parameters (e=0.7, a=3.74e11) for Mars encounter
- Document hysteresis makes Mars -> Sun exit impossible
- Simpler than original 7-body test_comet_orbit.cpp
- All 3 SOI tests pass (12 assertions total)
Claude
- Add hyperbolic_comet.toml with e=1.5, a=-1.496e11
- Add 3 test cases:
* Energy and escape trajectory (300 days)
* Initial conditions verification
* Asymptotic velocity validation (1000 days)
- Tests validate: v > v_escape, E > 0, e > 1.0, a < 0
- Asymptotic test uses 30% tolerance at 18+ AU distance
- Existing hyperbolic rendering unchanged
Claude
- Add render_parabolic_orbit() with true anomaly range -π*0.95 to π*0.95
- Use 80 segments for smooth parabolic curve visualization
- Update render_orbit() branching to handle parabolic (0.98 <= e <= 1.02)
- Calculate semi-latus rectum p = h²/μ for parabolic orbits
- Maintain existing elliptical/hyperbolic orbit rendering
Claude
- Update velocity calculation to handle e=1.0 (parabolic orbits)
using escape velocity formula v² = 2GM/r instead of vis-viva
- Add parabolic comet test configuration
- Add test cases for parabolic orbit energy and escape trajectory
Claude
- Remove CelestialBody and SimulationState forward declarations from physics.h
- Rename evaluate_acceleration_direct to evaluate_acceleration
- Update rk4_step to accept Vec3* and mass parameters directly
- Remove unused evaluate_acceleration function with SimulationState dependency
- Update simulation.cpp to extract and pass masses to rk4_step
Claude: partial refactoring cleanup
When bodies change gravitational parents, properly update their
local coordinates to maintain physics accuracy. This fixes the
bug where local positions were never updated when changing parents.
Also remove unused variable warning.
Document current progress after completing Phase 2:
- Phase 1 complete: Dual coordinate storage foundation
- Phase 2 complete: Local frame integration working
- Earth Moon test now passing (major success!)
- 7/9 tests passing (up from 6/9)
- Phases 3-5 deferred for future work
Added detailed status, commit references, and notes for future development
Modified physics integration to operate in local coordinate frames.
Parent bodies are treated as origin in child's reference frame.
Changes:
- rk4_step() now integrates local_position/local_velocity
- evaluate_acceleration() calculates gravity with parent at origin
- update_simulation() computes global coords FROM local after integration
- Added compute_global_coordinates() after root and child updates
Results:
- Earth Moon orbital stability test: NOW PASSING! (was failing)
- Moon drift reduced significantly (improved numerical precision)
- Test improvements: 3 failures → 2 failures (7/9 passing)
- Still failing: Io (Jupiter) and Titan (Saturn) - likely need tuning
Implements hierarchical_frames_plan.md Phase 2
Add dual coordinate storage to CelestialBody for hierarchical frames.
Both local (relative to parent) and global (absolute) coordinates maintained.
- Added local_position and local_velocity fields to CelestialBody
- Added initialize_local_coordinates() to convert global→local
- Added compute_global_coordinates() to convert local→global
- Updated config_loader to initialize local coords after velocity calc
- Updated update_simulation() to sync local coords after integration
- Phase 1 complete: foundation for local frame integration
Tests: Same 3 moon failures as before (no regression)
Implements hierarchical_frames_plan.md Phase 1
Removed barycentric orbit calculations for binary/multiple star systems.
Simplified calculate_initial_velocities() to only support single root body.
- Removed: compute_system_barycenter()
- Removed: compute_total_root_mass()
- Removed: set_root_bodies_velocity()
- Removed: print_system_info_if_multiple_roots()
- Simplified: calculate_initial_velocities() now sets root body velocity to zero
Remove unused multiple root body support
- Created tests/test_moon_orbits.cpp with 4 test cases:
* Moon orbital stability around Earth
* Galilean moons orbital stability around Jupiter
* Titan orbital stability around Saturn
* Combined solar system parent stability
- Enhanced test_utilities.h/cpp:
* Added min_time_days field to OrbitTracker
* Added create_orbit_tracker_with_min_time() for short-period orbits
- Fixed parent indexes in tests/configs/solar_system.toml:
* Moon: parent 3 (Mars) → 2 (Earth)
* Io/Europa/Ganymede/Callisto: parent 5 (Saturn) → 4 (Jupiter)
* Titan: parent 6 (Uranus) → 5 (Saturn)
- Updated semi_major_axis for moons to actual orbital distances
Tests reveal need for hierarchical orbit physics implementation.
Net change: +368 lines
- Removed add_body() function (unused across codebase)
- Renamed compute_initial_velocities() to calculate_initial_velocities()
- Removed redundant wrapper function
Removed 26 lines of dead code
- Rename bodies.h/cpp to simulation.h/cpp
- Refactor velocity initialization into smaller functions
- Add vec3_cross() utility for reusable calculations
- Clean up public API by making helpers static
- Break up calculate_initial_velocities() (114 lines) into 8 focused functions
- Add vec3_cross() utility to physics.cpp for reusable cross product calculation
- Make helper functions static in simulation.cpp (internal implementation detail)
- Remove unnecessary helper declarations from simulation.h (cleaner public API)
New helper functions:
- compute_perpendicular_orbital_velocity() - root body orbits
- compute_orbital_velocity_from_vis_viva() - child body orbits
- compute_system_barycenter() - barycenter calculation
- compute_total_root_mass() - total mass calculation
- set_root_bodies_velocity() - set all root velocities
- set_child_bodies_velocity() - set all child velocities
- print_system_info_if_multiple_roots() - debug output
Benefits:
- Code reuse: vec3_cross() used 2x (eliminates duplicate perpendicular logic)
- Testability: smaller functions easier to test individually
- Readability: descriptive names for each body type scenario
- Maintainability: main function reduced from 114 to 10 lines
Claude
- Renamed src/bodies.h to src/simulation.h
- Renamed src/bodies.cpp to src/simulation.cpp
- Updated all include references in src/ and tests/
- Updated Makefile to reference simulation.cpp
- Updated documentation references
Claude
- Add tomlc17 library as git submodule
- Update Makefile to build tomlc17.c with C compiler
- Replace config_loader.cpp with TOML-based implementation
- Add helper functions for parsing TOML tables (position, color)
- Convert all 5 config files from .txt to .toml format:
* configs/solar_system.toml - full solar system with planets and moons
* configs/example_binary_star.toml - binary star system
* configs/test_simple.toml - various orbit types for testing
* tests/configs/earth_circular.toml - Earth orbit test
* tests/configs/mars_circular.toml - Mars orbit test
- Update all test files to reference .toml extensions
- Remove old .txt config files (maintain compatibility)
- Support both INT64 and FP64 TOML values (tomlc17 type flexibility)
- All automated tests pass with new TOML format
Claude