Compares two double pendulum simulations that are run simultaneously: the theoretically accurate RigidDoublePendulumSim and the equivalent double pendulum using the engine2D physics engine's ContactSim. The purpose is to show that the two are closely equivalent.

The angles shown in graphs are modified for the ContactSim so that they are equivalent to the corresponding RigidDoublePendulumSim angles. The adjustment is given by RigidDoublePendulumSim.getGamma1 and RigidDoublePendulumSim.getGamma2.

Creates instance objects such as the simulation and display objects; defines regular expressions for easy Terminal scripting of these objects using short names instead of fully qualified property names.

The constructor takes an argument that 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. This allows for having two separate simulation apps running concurrently on a single page.

A global variable is created for this application instance outside of this file in the HTML where the constructor is called. The name of that global variable holding the application is passed to defineNames() method so that short-names in scripts can be properly expanded.

Hierarchy (view full)

Implements

Constructors

Methods

  • Define short-cut name replacement rules. For example 'sim' is replaced by 'app.sim' when myName is 'app'.

    Parameters

    • myName: string

      the name of this object, valid in global Javascript context.

    Returns void

  • Parameters

    • script: string
    • output: boolean = true

      whether to print the result to the output text area and add the script to session history; default is true

    Returns any

    the result of evaluating the string

  • Sets 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.

    Parameters

    • value: boolean

      whether this Subject should broadcast events

    Returns boolean

    the previous value

  • Sets the distance between the fixed pivot points of the two double pendulums.

    Parameters

    • value: number

      distance between the fixed pivot points

    Returns void

  • 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'}}
    

    Returns string

    a minimal string representation of this object.

Generated using TypeDoc