Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AR Gravity & Planetary Physics Simulator – GSoC 2026 Entry Task

Overview

This project implements a basic N-body gravitational simulation using Newtonian physics.
It models the interaction between multiple celestial bodies and visualizes their motion over time.

This implementation focuses on correctness, reproducibility, and clarity, which are essential for real-time physics simulations.

The work serves as a foundational step toward building a real-time AR gravity sandbox in Unity, where users can create and explore planetary systems interactively.


Physics Model

The simulation is based on Newton’s Law of Gravitation:

F = G * (m₁ * m₂) / r²

Where:

  • F → gravitational force
  • G → gravitational constant (scaled)
  • m₁, m₂ → masses
  • r → distance between bodies

Numerical Method

The simulation uses semi-implicit Euler integration:

  • Velocity update:
    v = v + a * Δt

  • Position update:
    x = x + v * Δt

A small softening factor is added to avoid numerical instability at very small distances.

The simulation is deterministic for fixed initial conditions and time step, ensuring reproducible results.


Simulation Details

  • 3-body system:
    • 1 central massive body (Sun)
    • 2 orbiting bodies (Planets)
  • The Sun is fixed to simplify visualization
  • Demonstrates gravitational interaction and orbital motion

Output

Running the simulation generates:

  • output.csv → position data over time
  • trajectory_plot.png → visualization of orbital paths

Visualization

Trajectory Plot


Requirements

  • Python 3.11.0
  • numpy
  • matplotlib

Install dependencies:

pip install -r requirements.txt

About

3-body N-body gravitational simulation with visualization and CSV output (GSoC 2026 Entry Task)

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages