specifies the names of the HTML elementId's to look for in the HTML document; these elements are where the user interface of the simulation is created.
Optional
opt_name: stringname of this as a Subject
Private
addAdd body to simulation, setting color based on mass. Heavier body will have darker color.
Add the control to the set of simulation controls.
the control that was passed in
Adds the given Observer to this Subject's list of Observers, so that the Observer
will be notified of changes in this Subject. An Observer may call Subject.addObserver
during its observe
method.
the Observer to add
Adds the Parameter to the list of this Subject's available Parameters.
the Parameter to add
if a Parameter with the same name already exists.
Notifies all Observers that this Subject has changed by calling observe on each Observer.
An Observer may call addObserver or removeObserver during its observe
method.
a SubjectEvent with information relating to the change
Notifies all Observers that the Parameter with the given name has changed by calling observe on each Observer.
the language-independent or English name of the Parameter that has changed
if there is no Parameter with the given name
Private
configProtected
getReturns whether broadcasting is enabled for this Subject. See setBroadcast.
whether broadcasting is enabled for this Subject
Returns the ParameterBoolean with the given name.
the language-independent or English name of the ParameterBoolean
the ParameterBoolean with the given name
if there is no ParameterBoolean with the given name
Returns the ParameterNumber with the given name.
the language-independent or English name of the ParameterNumber
the ParameterNumber with the given name
if there is no ParameterNumber with the given name
Returns the ParameterString with the given name.
the language-independent or English name of the ParameterString
the ParameterString with the given name
if there is no ParameterString with the given name
Optional
body: RigidBodythe rigid body to show in graphs
Creates the EasyScriptParser for this app. See explanation of dependent Subjects in EasyScriptParser documentation.
Optional
opt_dependent: Subject[]additional dependent Subjects
Private
makeRemoves the Observer from this Subject's list of Observers. An Observer may
call removeObserver
during its observe
method.
the Observer to detach from list of Observers
Removes the Parameter from the list of this Subject's available Parameters.
the Parameter to remove
Protected
setSets whether this Subject will broadcast events, typically used to temporarily disable broadcasting. Intended to be used in situations where a subclass overrides a method that broadcasts an event. This allows the subclass to prevent the superclass broadcasting that event, so that the subclass can broadcast the event when the method is completed.
whether this Subject should broadcast events
the previous value
Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.
For an object whose main purpose is to represent another Printable object, it is
recommended to include the result of calling toStringShort
on that other object.
For example, calling toStringShort()
on a DisplayShape might return something like
this:
DisplayShape{polygon:Polygon{'chain3'}}
a minimal string representation of this object.
Watch a Parameter and when it changes note that there was a discontinuous change in potential and total energy.
the Parameter to watch
Static
loadStatic
massGenerated using TypeDoc
Demonstrates that collision handling policies produce different results.
One Hits Two: two stationary blocks in resting contact; one block hits them
Two Hit One: central block is stationary; 2 blocks come in from left and right to hit it. See Physics-Based Animation chapter 6.2 'Multiple Points of Collision' by Erleben, et. al, which describes this scenario. This should result in an infinite loop for the serial collision handler, and it would except for some 'panic mode' error handling that occurs.
One Hits Two On Wall: two stationary blocks in resting contact against wall; one block hits them.
Two On Wall: row of two balls in contact with each other and a wall; only the ball touching the wall is moving (colliding into the wall).
to do: another to add: 1x3 block on ground, lying horizontally, pick up one corner (so the other corner still in contact) and let go. With simultaneous solver, the corner in contact stays in contact (unrealistic). With hybrid or serial it alternates which corner is bouncing.
This app has a config function which looks at a set of options and rebuilds the simulation accordingly. UI controls are created to change the options.