# Orbital Simulator Interfaces This project now includes multiple ways to interact with the orbital simulator: ## 1. Web Interface A browser-based interface with real-time 3D visualization. ### Features: - Real-time 3D orbital visualization using Three.js - Interactive controls (start, pause, stop, step) - Multiple simulation management - Custom configuration editor - Live statistics and energy monitoring - Responsive design ### Usage: ```bash # Start the API server cargo run --release --bin api_server # In another terminal, start the web frontend cd web npm install npm run dev # Open http://localhost:5173 in your browser ``` ## 2. Desktop GUI A native desktop application using Tauri (Rust + Web technologies). ### Features: - All web interface features in a native app - File system integration - Native notifications - System tray integration - Better performance than browser ### Usage: ```bash # Install Tauri CLI cargo install tauri-cli # Start development mode cargo tauri dev # Build for production cargo tauri build ``` ## 3. Command Line Interface (Original) The original command-line tools are still available: ```bash # Run simulation cargo run --release --bin simulator -- \ --config config/planets.toml \ --time 365d \ --step-size 3600 \ --output-file trajectory.bin # Visualize results python3 plot_trajectories.py trajectory.bin --animate # 3D real-time visualizer cargo run --release --bin orbiter -- trajectory.bin ``` ## API Endpoints The web API server provides RESTful endpoints: - `POST /api/simulations` - Create new simulation - `GET /api/simulations` - List all simulations - `GET /api/simulations/:id` - Get simulation state - `POST /api/simulations/:id/control` - Control simulation (start/pause/stop) - `DELETE /api/simulations/:id` - Delete simulation - `GET /api/configs` - List available configurations ## Installation ### Prerequisites: - Rust (latest stable) - Node.js 18+ (for web interface) - Python 3.7+ (for visualization) ### Full Installation: ```bash # Clone and build git clone cd orbital_simulator # Install Rust dependencies cargo build --release # Install Node.js dependencies cd web npm install cd .. # Install Python dependencies pip install -r requirements.txt # Install Tauri CLI (optional, for desktop GUI) cargo install tauri-cli ``` ### Quick Start: ```bash # Start everything with one command ./start_interfaces.sh ``` This will launch: - API server on port 3000 - Web interface on port 5173 - Desktop GUI (if Tauri is installed) ## Development ### Architecture: ``` ┌─────────────────┐ ┌─────────────────┐ │ Desktop GUI │ │ Web Interface │ │ (Tauri) │ │ (React) │ └─────────┬───────┘ └─────────┬───────┘ │ │ └──────────┬───────────┘ │ ┌─────────────────┐ │ API Server │ │ (Axum) │ └─────────┬───────┘ │ ┌─────────────────┐ │ Rust Simulator │ │ (Core Logic) │ └─────────────────┘ ``` ### Adding Features: 1. **Backend**: Add endpoints in `src/bin/api_server.rs` 2. **Web**: Add components in `web/src/components/` 3. **Desktop**: Add commands in `src-tauri/src/main.rs` ### Testing: ```bash # Test Rust code cargo test # Test web interface cd web npm test # Test API endpoints curl http://localhost:3000/api/simulations ```