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.
 
 
 
 
 

77 lines
2.4 KiB

#ifndef ORBITAL_OBJECTS_H
#define ORBITAL_OBJECTS_H
#include "physics.h"
#include "orbital_mechanics.h"
// Forward declarations
struct SimulationState;
// ============================================================================
// Rendezvous Types
// ============================================================================
enum RendezvousState {
RENDEZVOUS_NONE,
RENDEZVOUS_PLANNING,
RENDEZVOUS_APPROACHING,
RENDEZVOUS_MATCHING,
RENDEZVOUS_COMPLETE,
RENDEZVOUS_FAILED
};
struct RendezvousTarget { // Active rendezvous target configuration
int target_index; // Index of target spacecraft/body
RendezvousState state; // Current rendezvous state
double approach_distance; // Distance to start approach phase (m)
double capture_distance; // Distance for capture (m)
double max_relative_velocity; // Max closing speed for capture (m/s)
double cw_linearization_time; // Last time CW equations were linearized (s)
bool is_spacecraft_target; // True if target is spacecraft, false if body
};
// ============================================================================
// Celestial Body Structure
struct CelestialBody { // Gravitational body in the simulation
char name[64];
double mass; // kg
double radius; // meters
int parent_index; // index of gravitational parent (-1 for root body like Sun)
float color[3]; // RGB color for rendering
// Orbital elements from config (Keplerian elements)
OrbitalElements orbit;
// Global frame (from origin)
Vec3 global_position; // meters from origin
Vec3 global_velocity; // m/s
// Local frame (relative to parent)
Vec3 local_position; // meters from parent
Vec3 local_velocity; // m/s relative to parent
double soi_radius; // sphere of influence radius (meters)
};
struct Spacecraft { // Spacecraft or probe in the simulation
char name[64];
double mass;
int parent_index;
// Orbital elements from config
OrbitalElements orbit;
// Global frame (from origin)
Vec3 global_position;
Vec3 global_velocity;
// Local frame (relative to parent)
Vec3 local_position;
Vec3 local_velocity;
// Rendezvous support
RendezvousTarget rendezvous_target; // Active rendezvous target (if any)
};
#endif // ORBITAL_OBJECTS_H