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.8 KiB

Renderer Development Session (2026-01-03)

Changes Made:

1. Added orbit path visualization

  • Store orbital parameters (eccentricity, semi_major_axis) in CelestialBody struct
  • Render elliptical orbit paths for all non-root bodies
  • Orbits drawn as 100-segment line loops with semi-transparent body colors
  • Correctly places parent body at one focus of the ellipse

2. Implemented sim-to-render coordinate transform

  • Simulation uses XY plane (natural for physics)
  • Renderer uses XZ plane (natural for 3D top-down view)
  • sim_to_render() applies 90° rotation around X-axis: Y→Z, Z→-Y
  • All positions and orbits use consistent transformation

3. Fixed render scaling issue (renderer.cpp:26-27)

Problem: size_scale (5e-7) and distance_scale (1e-9) had inconsistent ratios

  • Sun radius: 6.96e8 m × 5e-7 = 348 units (engulfed orbits!)
  • Earth orbit: 1.496e11 m × 1e-9 = 149.6 units

Solution: Set size_scale = 1e-9 to match distance_scale

  • Result: Sun radius now 0.696 units, orbits clearly visible
  • Maintains physical accuracy with uniform scaling

4. Visual improvements

  • Changed bodies to wireframe spheres (DrawSphereWires)
  • Custom dark grid (RGB 20,20,20) instead of default bright grid
  • Bodies use saturated colors for visibility
  • Minimum radius (0.5 units) ensures small bodies remain visible

Rendering Parameters

  • distance_scale = 1e-9 (1 render unit = 1 billion meters = ~0.0067 AU)
  • size_scale = 1e-9 (same as distance_scale for physical accuracy)
  • min_radius = 0.5 (minimum visible body size)

Commits

  • d7d49b7 Add orbit path visualization with sim-to-render coordinate transform
  • 9b4009d Set DEFAULT_HEADLESS to 0 for renderer development
  • 4e2f00a Fix render scaling to match simulation coordinates

Known Issues

  • No known rendering issues at this time