- Rewrote orbital_mechanics.cpp with complete velocity component handling
- Added proper parabolic case in velocity section using semi_latus_rectum
- Parabolic velocity: vx = -sqrt(μ/p)*sin(ν), vy = sqrt(μ/p)*(1+cos(ν))
- Updated parabolic_comet.toml to use semi_latus_rectum = 2.992e11 (p=2 AU)
- With true_anomaly = 0.0, comet at perihelion (r = 1 AU, v = 42.13 km/s)
Test Results:
- 31 passed / 1 failed (up from 29/3)
- Parabolic orbit tests: All 3 assertions pass ✓
- Position and velocity mathematically correct for parabolic orbits
- Total energy approximately zero (FP precision: ~200 J/kg)
Note: test_invalid_parent_assignment still fails - pre-existing issue unrelated to parabolic implementation.
- Implemented union in OrbitalElements (semi_major_axis | semi_latus_rectum)
- Updated config_loader to validate parabolic vs elliptical/hyperbolic orbits
- Fixed orbital_mechanics.cpp parabolic case to use semi_latus_rectum
- Updated parabolic_comet.toml to use correct orbital parameters
- Updated validation logic for both bodies and spacecraft
- Created docs/parabolic_union_implementation.md with full implementation plan
- Updated docs/unified_orbital_elements_plan.md to mark phases 7-9 complete
Note: Parabolic orbit test velocity tolerance check fails due to test expecting
velocity at 1 AU, but config has comet at perihelion (0.5 AU).
Position and velocity are mathematically correct, energy is ~0.
- Added union in OrbitalElements (semi_major_axis | semi_latus_rectum)
- Updated config_loader to parse and validate semi_latus_rectum for parabolic orbits
- Validation ensures correct parameter (semi_latus_rectum for e≈1, semi_major_axis for other)
- Updated orbital_mechanics.cpp parabolic case: r = p / (1 + cos(ν))
- Updated parabolic_comet.toml to use semi_latus_rectum = 1.496e11
- Tolerance for parabolic detection: |e - 1.0| < 0.005
Note: Parabolic test still fails velocity tolerance check due to floating-point precision
at r=0.5 AU, E ≈ -200 J/kg (not exactly 0)
- Added orbital_mechanics module with orbital_elements_to_cartesian()
- Updated initialize_orbital_objects() to use orbital mechanics
- Added validate_initial_positions() for post-initialization checking
- Fixed test files to use global_position/global_velocity
- Updated config loader to support spacecraft altitude parameter
- Fixed orbital_mechanics.cpp velocity calculation bug (removed duplicate scaling)
- Updated Makefile to include orbital_mechanics.o in test build
- Renamed simulation.h OrbitalMetrics to OrbitalAnalysis to avoid conflict
- Added docs/parabolic_union_implementation.md for parabolic orbit support plan
Note: Test configs still need manual fix for orbit table TOML syntax
- Replace position/velocity with orbit table parsing
- Parse all orbital element fields with defaults
- Support altitude convenience field for semi_major_axis
- Add validation for orbital elements
- Remove manual position/velocity calculation from loader
- Build succeeds (expected unused function warning)
- Rename CelestialBody/Spacecraft position/velocity to global_*
- Add OrbitalElements struct to both bodies and spacecraft
- Rename old OrbitalElements to OrbitalMetrics (for output/analysis)
- Update all references throughout codebase
- Preserve parent_index in outer structs (not in OrbitalElements)
- Build succeeds with only unused variable warning
Replace 3D billboard rendering with 2D screen-space overlays using
GetWorldToScreen() and DrawTexturePro() for constant visibility.
Changes:
- Rename render functions to *_screen_space suffix
- Use GetWorldToScreen() to transform 3D positions to screen coordinates
- Replace DrawBillboard/DrawBillboardPro() with DrawTexturePro() for 2D rendering
- Use constant pixel sizes (40px spacecraft, 20-60px markers)
- Add off-screen culling to skip rendering outside viewport
- Update render order: 3D scene first, then 2D overlays
- Update documentation to reflect screen-space approach
Benefits:
- Markers remain visible at all zoom levels (constant screen size)
- Simplified sizing with pixel values instead of world-space math
- Better performance with off-screen culling
- Clearer separation: 3D scene vs UI indicators
- Create ui_renderer.cpp/h with all raygui UI panel rendering functions
- Remove UI rendering code from renderer.cpp (421 lines moved)
- Remove UI state fields from RenderState, create separate UIState struct
- Remove raygui dependency from renderer module
- Update main.cpp to initialize UIState and call UI render functions
- Update documentation to reflect new module structure
- Improve separation of concerns between 3D rendering and UI overlays
- Replace wireframe spheres with proper billboard textures
- Spacecraft rendered as cyan circle with arrow (64x64 texture)
- Maneuver markers as directional arrow billboards
- Spacecraft billboards rotate to show velocity direction
- Programmatic texture generation (no external assets)
- Lazy texture loading when spacecraft/maneuvers present
- Proper texture cleanup on renderer shutdown
- Spacecraft rendered as cyan wireframe spheres (fixed size for visibility)
- Maneuver markers as colored cubes (direction-based colors: green=prograde, red=retrograde, etc.)
- Object list now includes spacecraft with '🚀 ' prefix
- Camera follow extended to support spacecraft tracking
- Spacecraft info panel displays local coordinates and maneuver counts
- Maneuver list panel shows pending/executed status with details
- Panel renamed from 'Bodies' to 'Objects'
Extract large update_simulation function into focused helpers:
- update_bodies_physics() - Handle body RK4 and SOI transitions
- update_spacecraft_physics() - RK4 integration for spacecraft
- execute_pending_maneuvers() - Check triggers and execute burns
- compute_spacecraft_globals() - Global coords for spacecraft
Simplified update_simulation to call helpers sequentially:
1. Bodies physics
2. Bodies global coords
3. Spacecraft physics
4. Maneuver execution
5. Spacecraft global coords
6. Time step
Benefits:
- Single responsibility per function
- Cleaner, more readable code
- Easier to test individual components
- Net change: +96 lines (helper functions) -86 lines (removal)
All maneuver tests still passing.
Remove duplicate code blocks that were executing maneuvers twice.
Fix ensures correct update order:
1. Body RK4 updates
2. Body global coords
3. Spacecraft RK4 updates
4. Maneuver execution (once, with executed flag check)
5. Spacecraft global coords (from updated local_velocity)
This eliminates the redundant 'execute pending maneuvers' and 'compute spacecraft globals' blocks that were duplicated in the code.
Merge spacecraft management into simulation module:
- Move Spacecraft struct from maneuver.h to spacecraft.h
- Add spacecraft array to SimulationState (spacecraft, craft_count, max_craft)
- Remove separate SpacecraftState struct and related functions
- Update create_simulation() to require max_craft parameter
- Move spacecraft update logic into update_simulation()
- Make load_spacecraft_config() internal helper, called by load_system_config()
- Update all test files to use new API with 3-parameter create_simulation()
- Handle max_craft=0 case gracefully (no spacecraft allocation)
Test results: 26/27 passing (1 pre-existing SOI test unrelated to changes)
Add basic maneuvering API for spacecraft with impulsive delta-v burns in local frame:
- Add vec3_dot() function to physics module
- Create Spacecraft struct and SpacecraftState for separate spacecraft management
- Implement 6 burn directions: prograde, retrograde, normal, anti-normal, radial in/out
- Add RK4 propagation for spacecraft with update_spacecraft()
- Extend config loader to parse [[spacecraft]] TOML sections
- Add 6 test cases verifying burn physics and propagation stability
- Rename old mission_planning module to _old for future reference
Test results: 26/27 passing (1 pre-existing SOI test unrelated to changes)
- Deprecated initialize_spacecraft_leo() (now uses config-based init)
- Fixed retrograde velocity bug in simulation::calc_orbital_velocity()
- Fixed apply_transfer_burn() to correctly apply delta-v to local velocity
- Simplified test to validate burn formulas without long simulation
- Energy error: 0.011% (passes 5% tolerance)
- Net change: -20 lines
Updated docs to reflect that the spacecraft initialization bug has been
resolved by config validation.
docs/test_plan_invalid_parent_assignment.md:
- Changed status from "Implementation phase" to "Complete (Tests 1-3 resolved)"
- Updated bug diagnosis to show solution implemented
- Updated all test cases with actual results (Tests 1-3: ✅ PASS, Test 4: ❌ FAIL)
- Added implementation summary with commit references
- Updated test matrix to show actual results
- Updated future work section to reflect current status
docs/mission_planning.md:
- Marked FIXME as RESOLVED with solution details
- Updated spacecraft parameters to show corrected position
- Added note that delta-v issue remains pending
- Updated "position/velocity" line to reflect current implementation
Test Status:
- Test 1 (Earth→Spacecraft parent switch): ✅ RESOLVED
- Test 2 (Mass hierarchy): ✅ RESOLVED
- Test 3 (Config validation): ✅ RESOLVED
- Test 4 (Mutual SOI): ❌ PENDING (separate issue)