Package: orbitr 1.0.0

orbitr: A Tidy Physics Engine for Building and Visualizing Orbital Simulations

A lightweight, fully vectorized N-body physics engine built for the R ecosystem. Simulate and visualize complex orbital mechanics, celestial trajectories, and gravitational interactions using tidy data principles. Features multiple numerical integration methods, including the energy-conserving velocity Verlet algorithm (Verlet (1967) <doi:10.1103/PhysRev.159.98>), to ensure highly stable orbital propagation. Gravitational N-body methods follow Aarseth (2003, ISBN:0-521-43272-3).

Authors:Dave Rosenman [aut, cre]

orbitr_1.0.0.tar.gz
orbitr_1.0.0.zip(r-4.7-x86_64)orbitr_1.0.0.zip(r-4.7-arm64)orbitr_1.0.0.zip(r-4.6-x86_64)orbitr_1.0.0.zip(r-4.6-arm64)orbitr_1.0.0.zip(r-4.5-x86_64)
orbitr_1.0.0.tgz(r-4.6-x86_64)orbitr_1.0.0.tgz(r-4.6-arm64)orbitr_1.0.0.tgz(r-4.5-x86_64)orbitr_1.0.0.tgz(r-4.5-arm64)
orbitr_1.0.0.tar.gz(r-4.7-arm64)orbitr_1.0.0.tar.gz(r-4.7-x86_64)orbitr_1.0.0.tar.gz(r-4.6-arm64)orbitr_1.0.0.tar.gz(r-4.6-x86_64)
orbitr_1.0.0.tgz(r-4.6-emscripten)
manual.pdf |manual.html✨
DESCRIPTION |NEWS
card.svg |card.png
orbitr/json (API)

# Install 'orbitr' in R:
install.packages('orbitr', repos = c('https://drosenman.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/drosenman/orbitr/issues

Pkgdown/docs site:https://orbit-r.com

Uses libs:
  • c++– GNU Standard C++ Library v3

On CRAN:

Conda:

cpp

6.44 score 4 stars 15 scripts 367 downloads 61 exports 26 dependencies

Last updated from:6800acb131. Checks:13 NOTE, 2 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-arm64NOTE165
linux-devel-x86_64NOTE201
source / vignettesOK422
linux-release-arm64NOTE138
linux-release-x86_64NOTE173
macos-release-arm64NOTE125
macos-release-x86_64NOTE352
macos-oldrel-arm64NOTE126
macos-oldrel-x86_64NOTE291
windows-devel-arm64NOTE289
windows-devel-x86_64NOTE178
windows-release-arm64NOTE212
windows-release-x86_64NOTE152
windows-oldrel-x86_64NOTE127
wasm-releaseOK149

Exports:add_bodyadd_body_keplerianadd_planetadd_sunanimate_systemanimate_system_3dconserved_quantitiescontinue_simulationcreate_systemdistance_earth_moondistance_earth_sundistance_jupiter_sundistance_mars_sundistance_mercury_sundistance_neptune_sundistance_pluto_sundistance_saturn_sundistance_uranus_sundistance_venus_sunexport_bodiesget_angular_momentumget_bodiesget_energyget_momentumget_orbital_elementsgravitational_constantload_solar_systemload_systemmass_earthmass_jupitermass_marsmass_mercurymass_moonmass_neptunemass_plutomass_saturnmass_sunmass_uranusmass_venusplot_orbitsplot_orbits_3dplot_systemplot_system_3dremove_bodysave_systemseconds_per_dayseconds_per_hourseconds_per_yearshift_reference_framesimulate_systemspeed_earthspeed_jupiterspeed_marsspeed_mercuryspeed_moonspeed_neptunespeed_plutospeed_saturnspeed_uranusspeed_venussystem_from_simulation

Dependencies:clicpp11dplyrfarvergenericsggplot2gluegtableisobandlabelinglifecyclemagrittrpillarpkgconfigR6RColorBrewerRcpprlangS7scalestibbletidyselectutf8vctrsviridisLitewithr

Checking a Simulation
Energy, Momentum, and Angular Momentum | Conserved Quantities | Reading the energy plot | What Orbit Is It Actually On? | A note on the gravitational parameter | Continuing a Run | Editing between segments

Last update: 2026-10-01
Started: 2026-10-01

Keplerian Orbital Elements
The Six Elements | Shape: Semi-Major Axis and Eccentricity | Orientation: Inclination, Longitude of Ascending Node, and Argument of Periapsis | Position: True Anomaly | Hyperbolic Orbits | The Conversion: Elements to Cartesian | Using add_planet() for Quick Setup | Keplerian vs. Cartesian: When to Use Which

Last update: 2026-10-01
Started: 2026-04-13

Reference Frames
The Problem of Scale | Shifting the Reference Frame | How It Works | Keeping vs. Removing the Center Body | Multiple Perspectives on the Same Data | The Barycentric Frame | Analyzing Relative Velocities | A Binary Star System from the Planet's View | Practical Tips

Last update: 2026-10-01
Started: 2026-04-06

Roadmap
Physics | A radius argument on add_body() | Non-gravitational forces | General-relativistic corrections | Setup helpers | ~~Construct bodies from Keplerian orbital elements~~ ✅ Added in v0.2.0 | ~~A load_solar_system() convenience~~ ✅ Added in v0.2.0 | Quality of life | ~~Save and load simulation state~~ ✅ Added in v0.3.0 | Progress bar for long simulations | Built-in conservation diagnostics ✅ Added in v1.0.0 | Variable time steps ✅ Partly addressed in v1.0.0 | Suggestions Welcome

Last update: 2026-10-01
Started: 2026-04-07

The Physics
Gravitational Acceleration | Why Initial Velocity Matters | Gravitational Softening | Numerical Integration Methods | 1. Velocity Verlet (default, method = "verlet") | 2. Euler-Cromer (method = "euler_cromer") | 3. Standard Euler (method = "euler") | Comparing the Three Methods | Keplerian Orbital Elements | From Elements to Cartesian State Vectors | Kepler's Laws and the Simulation | The C++ Engine

Last update: 2026-10-01
Started: 2026-04-05

Quick Start Guide
Installation | Your First Simulation in 30 Seconds | Customizing the Plot | Watching the Orbit in Motion | Adding More Bodies | Removing Bodies | Inspecting a System | The Output is Just a Tibble | Saving and Sharing Systems | Next Steps

Last update: 2026-09-22
Started: 2026-04-05

Examples
The Full Solar System | The Inner Solar System | The Earth-Moon System | The Sun-Earth System | The Three-Body Problem (Sun-Earth-Moon) | Shifting Your Point of View | The Kepler-16 System: A Real Circumbinary Planet | A Comet Crossing the Inner Solar System | What-If: Circular Mars

Last update: 2026-04-18
Started: 2026-04-05

Further Reading
Books | Classical Dynamics of Particles and Systems — Stephen T. Thornton & Jerry B. Marion (5th ed., 2004, Brooks/Cole) | Computational Physics — Mark Newman (2012, CreateSpace) | Data Structures & Algorithms in Python — John Canning, Alan Broder & Robert Lafore (2022, Addison-Wesley) | Online Documentation | Rcpp Documentation — CRAN | Acknowledgments

Last update: 2026-04-18
Started: 2026-04-18

3D Plotting
How the 2D/3D Dispatch Works | A Tilted Lunar Orbit | Forcing 3D for Flat Data

Last update: 2026-04-09
Started: 2026-04-05

Building Two-Body Orbits From Scratch
The Convention: Central Body at the Origin | Why Velocity Must Be Perpendicular to Position | The Circular Orbit Velocity | What Happens If You Get the Speed Wrong? | Escape Velocity | Which Direction Does the Orbit Go? | Rotating the Whole Setup | When the Central Body Isn't Much Heavier | Recap

Last update: 2026-04-09
Started: 2026-04-08

Built-In Physical Constants
Masses | Orbital Distances (Semi-Major Axes) | Mean Orbital Speeds | Using the Constants | Why "Distance" Constants Are Semi-Major Axes

Last update: 2026-04-09
Started: 2026-04-05

Custom Visualization with ggplot2 and plotly
The Raw Output | Custom ggplot2 Visualizations | Custom plotly Visualizations

Last update: 2026-04-09
Started: 2026-04-05

Unstable Orbits and the Three-Body Problem
A Chaotic Triple-Star System | Troubleshooting Unstable Simulations

Last update: 2026-04-09
Started: 2026-04-05

Readme and manuals

Help Manual

Help pageTopics
Add a physical body to the systemadd_body
Add a body using Keplerian orbital elementsadd_body_keplerian
Add a known solar system body by nameadd_planet
Add the Sun to the systemadd_sun
Animate the System Over Time (Smart 2D/3D Dispatch)animate_system
Animate the System Over Time in Interactive 3Danimate_system_3d
Conserved quantities and how well a simulation conserved themconserved_quantities
Continue a simulation from its last statecontinue_simulation
Initialize an orbitr simulation systemcreate_system
Export body states to CSVexport_bodies
Extract the body table from a systemget_bodies
Total energy of a simulated systemget_energy
Total linear and angular momentum of a simulated systemget_angular_momentum get_momentum
Osculating orbital elements of a body relative to a parentget_orbital_elements
Load a pre-built solar systemload_solar_system
Load an orbit_system from diskload_system
Physical Constants for Orbital Mechanicsdistance_earth_moon distance_earth_sun distance_jupiter_sun distance_mars_sun distance_mercury_sun distance_neptune_sun distance_pluto_sun distance_saturn_sun distance_uranus_sun distance_venus_sun gravitational_constant mass_earth mass_jupiter mass_mars mass_mercury mass_moon mass_neptune mass_pluto mass_saturn mass_sun mass_uranus mass_venus physical_constants seconds_per_day seconds_per_hour seconds_per_year speed_earth speed_jupiter speed_mars speed_mercury speed_moon speed_neptune speed_pluto speed_saturn speed_uranus speed_venus
Plot Orbital Trajectories (Smart 2D/3D Dispatch)plot_orbits
Plot 3D Interactive Orbital Trajectoriesplot_orbits_3d
Plot System Snapshot at a Single Time (Smart 2D/3D Dispatch)plot_system
Plot 3D Interactive System Snapshot at a Single Timeplot_system_3d
Print an orbit_systemprint.orbit_system
Remove one or more bodies from the systemremove_body
Save an orbit_system to disksave_system
Shift the coordinate reference frame of the simulationshift_reference_frame
Simulate kinematics for an orbitr systemsimulate_system
Rebuild an orbit_system from a simulation snapshotsystem_from_simulation