Calculates Force's on MassObject's, for example gravity, damping, spring force, etc.

interface ForceLaw {
    calculateForces(): Force[];
    disconnect(): void;
    getBodies(): MassObject[];
    getPotentialEnergy(): number;
    toStringShort(): string;

Hierarchy (view full)

Implemented by


  • Returns a list of Forces generated by this ForceLaw.

    Returns Force[]

    list of forces generated by this ForceLaw.

  • Ensures this ForceLaw is not connected to anything and so can be garbage collected. For example, if this ForceLaw is an Observer, this will stop observing its Subject.

    Returns void

  • Returns the potential energy due to this ForceLaw.

    Returns number

    the potential energy due to this ForceLaw

  • 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:


    Returns string

    a minimal string representation of this object.

Generated using TypeDoc