Gravity Simulator
=================

Runs in a browser. Just serve `index.html` and associated `css` and `js`.

Uses `npm` for `eslint`.

Screenshots
-----------

![A binary pair orbiting a larger partner](./screenshots/gravity-simulator-4.png "Gravity Simulator Screenshot 4")

![A greater mass attracts others which had been on escape trajectories](./screenshots/gravity-simulator-5.png "Gravity Simulator Screenshot 5")

![A small object orbits a more massive binary pair](./screenshots/gravity-simulator-6.png "Gravity Simulator Screenshot 6")


TODO
----

- [x] Selection Box
- [x] Feature: Object List
- [x] Feature: Object Detail
- [x] Feature: Zoom to Object
- [ ] Feature: Teleport Object
- [ ] Enhancement: Create Time class and refactor to use
- [x] Enhancement: Create Vector class and refactor to use
- [x] Enhancement: Create Panning class and refactor to use
- [ ] Enhancement: Handle pointerleave or other mechanism when window loses focus
- [x] Enhancement: Calculate Work as FxD as measure of energy flux
- [ ] Feature: Automatically slow time when energy flux is greater
- [ ] Enhancement: Add z-axis (Initially nothing changes, z = 0)
- [ ] Feature: Isometric 3d View
- [ ] Feature: Grid
- [ ] Feature: Polar Coordinates
- [ ] Feature: Cylindrical Coordinates
- [ ] Feature: Spherical Coordinates
- [x] Feature: Camera Velocity Display
- [x] Enhancement: World State Snapshots
- [x] Feature: List / Save / Load World States
- [ ] Enhancement: Save / Load Snapshots from Local Storage
- [x] Feature: Import / Export / Share Snapshots
- [ ] Feature: Left Button Panning
- [ ] Feature: Middle Button Pause
- [ ] Feature: Parameter Slider (Invisible, mouse/touch drag)
- [ ] Enhancement: Zoom Easing
- [ ] Feature: 2-touch Pan & Zoom
  Either continuous zoom, or discrete with animation of bounding box proposed changes
- [ ] Feature: Multi-touch Mass Create
- [ ] Feature: Camera Rotation
  - [ ] 2-touch Rotation
  - [ ] Spinning Frame
- [ ] Feature: Undo
  - [ ] Undo "Clear Traces" Action
  - [ ] In general have a user action history
  - [ ] Point-in-time restoral of world state (Marked points, i.e. Snapshots)
- [ ] Feature: Time Control: Reverse Time
- [ ] Feature: Lossy Rescaling To Widen Zoom (Handling overflow/underflow)
- [ ] Enhancement: Track farthest reaches, min/max in each dimension (x, y)
- [x] Fix: Unpause panning when initiated while sim is paused
- [ ] Enhancement: Refactor to use viewOrigin as center of display canvas
- [ ] Feature: Dark Matter
  - [ ] Enhancement: Clumps of dark matter to help gather stray objects in the universe
