Browse Source

Fix enum and struct styling in orbital_objects.h

- Convert typedef enum to C++ style enum
- Convert typedef struct to C++ style struct {}
- Add RendezvousState type to RendezvousTarget::state field
- Update comments to one-liners with inline descriptions
- Remove redundant struct names from comments
main
cinnaboot 3 months ago
parent
commit
1bb7c820d7
  1. 45
      src/orbital_objects.h

45
src/orbital_objects.h

@ -11,52 +11,29 @@ struct SimulationState;
// Rendezvous Types // Rendezvous Types
// ============================================================================ // ============================================================================
/** enum RendezvousState {
* Rendezvous state machine
*
* States:
* - NONE: No rendezvous active
* - PLANNING: Target selected, approaching
* - APPROACHING: Closing in on target
* - MATCHING: Velocity matching phase
* - COMPLETE: Rendezvous successful
* - FAILED: Rendezvous failed
*/
typedef enum {
RENDEZVOUS_NONE, RENDEZVOUS_NONE,
RENDEZVOUS_PLANNING, RENDEZVOUS_PLANNING,
RENDEZVOUS_APPROACHING, RENDEZVOUS_APPROACHING,
RENDEZVOUS_MATCHING, RENDEZVOUS_MATCHING,
RENDEZVOUS_COMPLETE, RENDEZVOUS_COMPLETE,
RENDEZVOUS_FAILED RENDEZVOUS_FAILED
} RendezvousState; };
/** struct RendezvousTarget { // Active rendezvous target configuration
* Rendezvous target structure
*
* Tracks the active rendezvous target and state for a spacecraft
*/
typedef struct {
int target_index; // Index of target spacecraft/body int target_index; // Index of target spacecraft/body
int state; // RendezvousState RendezvousState state; // Current rendezvous state
double approach_distance; // Distance to start approach phase (m) double approach_distance; // Distance to start approach phase (m)
double capture_distance; // Distance for capture (m) double capture_distance; // Distance for capture (m)
double max_relative_velocity; // Max closing speed for capture (m/s) double max_relative_velocity; // Max closing speed for capture (m/s)
double cw_linearization_time; // Last time CW equations were linearized (s) double cw_linearization_time; // Last time CW equations were linearized (s)
bool is_spacecraft_target; // True if target is spacecraft, false if body bool is_spacecraft_target; // True if target is spacecraft, false if body
} RendezvousTarget; };
// ============================================================================ // ============================================================================
// Celestial Body Structure // Celestial Body Structure
/** struct CelestialBody { // Gravitational body in the simulation
* Celestial Body Structure
*
* Represents a planet, star, moon, or other gravitational body
* in the simulation. Supports hierarchical orbital mechanics with
* parent-child relationships and sphere of influence calculations.
*/
struct CelestialBody {
char name[64]; char name[64];
double mass; // kg double mass; // kg
double radius; // meters double radius; // meters
@ -77,13 +54,7 @@ struct CelestialBody {
double soi_radius; // sphere of influence radius (meters) double soi_radius; // sphere of influence radius (meters)
}; };
/** struct Spacecraft { // Spacecraft or probe in the simulation
* Spacecraft Structure
*
* Represents a spacecraft or probe in the simulation.
* Supports orbital mechanics, maneuvers, and rendezvous operations.
*/
struct Spacecraft {
char name[64]; char name[64];
double mass; double mass;
int parent_index; int parent_index;

Loading…
Cancel
Save