Skip to content

Commit

Permalink
doc directory added, incl. model and implementation notes, see #55
Browse files Browse the repository at this point in the history
  • Loading branch information
mbarlow12 committed Mar 15, 2018
1 parent 48a72cf commit 34c1651
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
20 changes: 20 additions & 0 deletions doc/implementation-notes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Gravity Force Lab Basics - Implementation Notes

This document contains notes that will be helpful to developers and future maintainers of this simulation.

## Model

Start by reading the model description in https://github.com/phetsims/gravity-force-lab-basics/blob/master/doc/model.md

Following that, almost all types in the model and view are inherited from the Inverse Square Law Common library. It will be useful to become familiar with its [model](https://github.com/phetsims/inverse-square-law-common/blob/master/doc/model.md) and [implementation](https://github.com/phetsims/inverse-square-law-common/blob/master/doc/implementation-notes.md)

The primary type in this sim is the `Mass`. It handles all positioning as well as the mass values needed to calculate the displayed force. It is an ISLCObject where only one of radius or density is dynamic at a time.

Unlike in Coulomb's Law, here the force can only be attractive, and it is measured from the objects' centers.

## View

The user will mainly be interacting with the ruler, the mass objects, and their control panel. The mass objects have a minimum separation that is always maintained. When dragging one mass, the other's position will never change. Finally, the arrows are added to the screenviews as siblings of the mass nodes themselves. This ensures that both arrows appear in the top layer of the scene graph.

### Mass Nodes
These are instances of ISLCObjectNodes with dynamic or constant radius. See the [ISLC implementation](https://github.com/phetsims/inverse-square-law-common/blob/master/doc/implementation-notes.md) for the details on updating pullers, force values, and arrows.
18 changes: 18 additions & 0 deletions doc/model.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Model Notes
===========

This document describes the model for the Gravity Force Lab simulation. <br>
@author Jesse Greenberg (PhET Interactive Simulations)
@author Michael Barlow (PhET Interactive Simulations)

The underlying model for gravitational forces between two masses depicted in this simulation is Newton's law of Gravitation.
Please see
https://en.wikipedia.org/wiki/Newton%27s_law_of_universal_gravitation for more information on this.

The simulation portrays how the gravitational force changes when masses are changed or the distance between them changes.

## Inverse Square Law

As an example of an Inverse Square Law, the underlying model for the gravitational force can be found at:

[Inverse Square Law Common](https://github.com/phetsims/inverse-square-law-common/blob/master/doc/model.md)

0 comments on commit 34c1651

Please sign in to comment.