vibe coding an orbital mechanics simulation to try out claude code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

1.3 KiB

Refactor Orbital Elements Session (2026-01-04)

Changes Made

Refactored orbital elements calculation from test-specific to reusable code:

  • Moved OrbitalElements struct from test file to src/simulation.h
  • Moved calculate_orbital_elements() function to src/simulation.cpp
  • Created tests/test_comet_orbit.cpp with SOI transition tracking
  • Added ParentChange tracking to detect when comet switches gravitational parent
  • Removed tests/test_soi_transitions.cpp (not useful for detecting actual transitions)
  • Updated Makefile to include new test file

Commits

  • 0e2f9dd Refactor orbital elements to reusable code and track SOI transitions

Results

4 files changed, +225/-1 (net +224 lines)

Orbital elements calculation is now reusable across the codebase. Test properly tracks parent index changes, though current configuration shows comet misses Mars's SOI by ~0.0004 AU (likely due to 60s time step granularity).

Outstanding Issue

Test fails to reproduce manual debugging results. Manual debugging showed parent_index changing to 2 (Mars) at sim->time ≈ 133914000s (~1550 days), but automated test detects no parent changes. Closest approach in test: 0.004200 AU, Mars SOI: ~0.00379 AU. Discrepancy may be due to time step granularity (60s), different initial conditions, or timing of SOI calculations. Requires further investigation.