From 5aeefa40ee1627625c71c60815085e68eaaa728a Mon Sep 17 00:00:00 2001 From: cinnaboot Date: Fri, 2 Jan 2026 13:23:29 -0500 Subject: [PATCH] add an overview to fix configuration bugs --- docs/config_assumptions.md | 54 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 docs/config_assumptions.md diff --git a/docs/config_assumptions.md b/docs/config_assumptions.md new file mode 100644 index 0000000..76b6167 --- /dev/null +++ b/docs/config_assumptions.md @@ -0,0 +1,54 @@ +# Configuration File Assumptions and Issues + +## Key Assumptions Found: + +### **1. Format Assumptions (from config_loader.cpp)** +- Line buffer limited to 256 characters (config_loader.cpp:30) +- Name limited to 64 characters (config_loader.cpp:31) +- All 10 fields must be present: `name mass radius x y z parent_index r g b` (config_loader.cpp:19) +- File format is space-delimited + +### **2. Solar System Configuration Issues:** + +**Problem 1: Moon position is incorrect** +- Earth is at: `(1.496e11, 0, 0)` m +- Moon is at: `(1.500e11, 0, 0)` m +- Distance: ~4 million km, but Earth-Moon distance should be ~384,400 km (~3.844e8 m) +- The Moon should be at approximately `(1.496e11 + 3.844e8, 0, 0)` or similar + +**Problem 2: Jupiter's moons positions** +- Jupiter is at: `(7.785e11, 0, 0)` m +- Io is at: `(8.207e11, 0, 0)` m - **422 million km from Jupiter** (should be ~422,000 km = 4.22e8 m) +- Europa is at: `(8.456e11, 0, 0)` m - **671 million km from Jupiter** (should be ~671,000 km = 6.71e8 m) +- Ganymede/Callisto have similar issues + +The moon positions appear to use **absolute coordinates** matching their orbital radii around the Sun, not relative positions around their parent bodies! + +### **3. Binary Star Configuration Issues:** + +**Problem 1: Both stars have parent_index = -1** +- StarA: `parent_index = -1` +- StarB: `parent_index = -1` +- This means both are treated as root bodies with zero velocity (config_loader.cpp:69) +- They won't orbit each other! + +**Problem 2: Planet positions** +- PlanetA1 is at `(3.5e11, 0, 0)` while StarA is at `(3.0e11, 0, 0)` - only 50 million km apart +- PlanetB1 is at `(-4.2e11, 0, 0)` while StarB is at `(-3.7e11, 0, 0)` - only 50 million km apart +- These seem reasonable as absolute positions, but the velocity calculation assumes circular orbits + +### **4. Velocity Calculation Assumptions (config_loader.cpp:63-118):** +- All orbits are assumed to be **circular** +- Orbits are calculated in the XY plane perpendicular to Z-axis (config_loader.cpp:92) +- Root bodies (parent_index = -1) get zero velocity +- Velocities are calculated relative to parent, then parent's velocity is added + +### **5. Critical Assumption:** +The code assumes **positions are absolute (heliocentric)**, but for child bodies like moons, the **positions in the config should be relative to their parent**. This is not clearly documented and appears inconsistent! + +## Recommended Actions: + +1. Fix moon positions in solar_system.txt to be correct absolute coordinates +2. Fix binary star system to have one star orbit the other (or implement barycenter) +3. Document whether positions should be absolute or relative to parent +4. Add validation to check if child body positions make sense relative to parent