A professional-grade 3D solar system visualization with accurate astronomical data and N-body physics simulation. Built with Three.js and modern web technologies, PLANETARY provides an interactive educational experience for exploring our solar system with real-time physics calculations, orbital mechanics, and high-quality 3D rendering.
- Real astronomical data from NASA JPL Horizons and Minor Planet Center
- N-body physics simulation with Runge-Kutta 4th order integration
- Keplerian orbital mechanics for efficient computation
- Perturbation effects including J2, atmospheric drag, and solar radiation pressure
- Historical and future date simulation (1900-2100)
- Advanced camera controls with multiple viewing modes (orbit, follow, free-fly)
- Real-time tooltips with detailed astronomical information
- Time acceleration controls from real-time to years-per-second
- Interactive object selection and detailed information panels
- Preset camera views for optimal viewing experiences
- WebGL 2.0 rendering with Three.js
- Level of Detail (LOD) system for performance optimization
- Web Workers for physics calculations
- Adaptive quality settings based on performance metrics
- Memory management and performance monitoring
- Comprehensive object database including planets, moons, asteroids, and comets
- Orbital visualization with trajectory prediction
- Scale visualization options for better understanding
- Astronomical coordinate systems and transformations
- Node.js 18.0.0 or higher
- npm or yarn package manager
- Modern web browser with WebGL 2.0 support (Chrome 56+, Firefox 51+, Safari 15+)
-
Clone the repository
git clone https://github.com/your-username/planetary.git cd planetary -
Install dependencies
npm install
-
Start the development server
npm run dev
-
Open your browser Navigate to
http://localhost:5173to see the application running.
# Install and run with example data
npm install
npm run dev
# Open browser to http://localhost:5173
# The application will load with the full solar systemplanetary/
├── src/ # Source code
│ ├── celestial/ # Celestial body classes and systems
│ │ ├── CelestialBody.js # Base celestial body class
│ │ ├── Planet.js # Planet-specific functionality
│ │ ├── Star.js # Star-specific functionality
│ │ ├── Moon.js # Moon-specific functionality
│ │ ├── Asteroid.js # Asteroid-specific functionality
│ │ └── SolarSystem.js # Solar system management
│ ├── physics/ # Physics simulation modules
│ │ ├── NBodyIntegrator.js # N-body physics integration
│ │ ├── KeplerianOrbit.js # Keplerian orbital mechanics
│ │ ├── Perturbations.js # Orbital perturbations
│ │ └── CoordinateTransform.js # Coordinate transformations
│ ├── rendering/ # 3D rendering components
│ │ ├── RenderingManager.js # Main rendering controller
│ │ ├── MaterialManager.js # Material and texture management
│ │ ├── LightingManager.js # Lighting and shadows
│ │ └── OrbitVisualization.js # Orbit trail rendering
│ ├── core/ # Core application logic
│ │ ├── Engine.js # Main application engine
│ │ ├── DataManager.js # Data loading and caching
│ │ ├── CameraControls.js # Camera control system
│ │ └── WorkerManager.js # Web worker management
│ ├── ui/ # User interface components
│ ├── utils/ # Utility functions and constants
│ └── workers/ # Web worker scripts
├── docs/ # Documentation
├── examples/ # Usage examples
├── test/ # Test configuration
└── public/ # Static assets
import { Engine } from './src/core/Engine.js';
import { SolarSystem } from './src/celestial/SolarSystem.js';
// Initialize the application
const engine = new Engine({
container: document.getElementById('solar-system'),
enablePhysics: true,
timeAcceleration: 1000 // 1000x real-time
});
// Create and load the solar system
const solarSystem = new SolarSystem();
await solarSystem.loadDefaultBodies();
// Start the simulation
engine.start();// Custom physics settings
const engine = new Engine({
container: document.getElementById('container'),
physics: {
integrator: 'rk4', // Runge-Kutta 4th order
timeStep: 3600, // 1 hour steps
enablePerturbations: true, // Include orbital perturbations
softening: 1e6 // Gravitational softening
},
rendering: {
antialias: true,
shadows: true,
postProcessing: true,
quality: 'high'
},
camera: {
mode: 'orbit',
target: 'earth',
distance: 10 // AU
}
});import { Planet } from './src/celestial/Planet.js';
// Create a custom planet
const customPlanet = new Planet({
name: 'Custom Planet',
mass: 5.972e24, // kg
radius: 6.371e6, // meters
semiMajorAxis: 2.0 * 1.496e11, // 2 AU
eccentricity: 0.05,
inclination: 0.1, // radians
color: 0x4169e1
});
solarSystem.addBody(customPlanet);# Development
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
# Testing
npm test # Run all tests
npm run test:ui # Run tests with UI
npm run test:runner # Custom test runner
# Code Quality
npm run lint # Run ESLint
npm run lint:fix # Fix linting issues
npm run format # Format code with Prettier
npm run check # Run all quality checksThe project includes comprehensive test coverage:
# Run all tests
npm test
# Run specific test suite
npm run test:runner -- celestial-bodies
npm run test:runner -- physics-components
npm run test:runner -- utils
# Run tests with coverage
npm run test:runner -- --coverage
# Run interactive test UI
npm run test:ui- Code Style: Follow the ESLint and Prettier configurations
- Testing: Write tests for all new functionality
- Documentation: Update documentation for API changes
- Performance: Consider performance impact of changes
- Browser Support: Test in multiple browsers
See DEVELOPMENT.md for detailed development guidelines.
Minimum:
- CPU: Intel i3 / AMD equivalent
- RAM: 4GB
- GPU: Integrated graphics with WebGL 2.0 support
- Browser: Chrome 70+, Firefox 65+, Safari 15+
Recommended:
- CPU: Intel i5 / AMD Ryzen 5
- RAM: 8GB
- GPU: Dedicated graphics card
- Browser: Latest Chrome, Firefox, or Safari
- Adaptive Quality: Automatically adjusts rendering quality based on performance
- LOD System: Level of detail for distant objects
- Web Workers: Physics calculations run in background threads
- Memory Management: Efficient memory usage and garbage collection
- Performance Monitoring: Real-time performance metrics
The project includes comprehensive test coverage across all modules:
- Unit Tests: 148+ tests covering core functionality
- Integration Tests: Component interaction testing
- Performance Tests: Benchmark critical code paths
- Browser Tests: Cross-browser compatibility
Run tests with:
npm test # All tests
npm run test:runner -- physics # Physics module tests
npm run test:runner -- celestial # Celestial body testsSee TESTING.md for detailed testing information.
Main application controller that orchestrates all subsystems.
const engine = new Engine(options);
engine.start();
engine.pause();
engine.setTimeAcceleration(factor);Manages collections of celestial bodies and their interactions.
const solarSystem = new SolarSystem();
await solarSystem.loadDefaultBodies();
solarSystem.addBody(celestialBody);
solarSystem.update(deltaTime);Base class for all astronomical objects.
const body = new CelestialBody({
name: 'Object Name',
mass: 1e24,
radius: 6e6,
position: { x: 0, y: 0, z: 0 },
velocity: { x: 0, y: 1000, z: 0 }
});For complete API documentation, see docs/API.md.
// examples/basic-usage.js
import { Engine, SolarSystem } from '../src/index.js';
const engine = new Engine({
container: document.getElementById('app')
});
const solarSystem = new SolarSystem();
await solarSystem.loadDefaultBodies();
engine.start();// examples/advanced-physics.js
// Demonstrates custom N-body simulation setup// examples/camera-controls-usage.js
// Shows different camera control modesSee the examples/ directory for more detailed examples.
We welcome contributions! Please see our Contributing Guidelines for details.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Add tests for new functionality
- Run the test suite (
npm test) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project follows the Contributor Covenant Code of Conduct.
This project is licensed under the MIT License - see the LICENSE file for details.
- NASA JPL for providing accurate astronomical data through the Horizons system
- Minor Planet Center for asteroid and comet orbital elements
- Three.js community for the excellent 3D rendering library
- Open source contributors who make projects like this possible
- Documentation: docs/
- Examples: examples/
- Issues: Please use the GitHub issue tracker
- Discussions: Use GitHub Discussions for questions and ideas
Built with ❤️ for space exploration and education
PLANETARY - Bringing the cosmos to your browser
