An object in a Simulation which can be displayed. The purpose of SimObjects is two-fold:
to give the outside world a view of what is going on in the Simulation.
SimObjects are often used in a Simulation's internal calculations.
A set of SimObjects are usually stored in a
SimObjects represent the current state of the Simulation. For an ODESim the current
state is dictated by the VarsList and the SimObjects reflect that state in their
positions. The SimObjects give additional information that is not in the VarsList, such
as size, shape, and mass of objects, or they can show forces or anchor objects.
SimObjects only reflect the current state after the
myphysicslab.lab.model.Simulation#modifyObjects method is called.
myphysicslab.lab.view.DisplayObject for a discussion of how SimObjects are
made visible to the user.
A SimObject has an expiration time so that we can add temporary objects,
representing things like forces or collision impact, and set the time at which they
should be removed from the simulation display. Permanent SimObjects have infinite
expiration time. See
this.getName( opt_localized ) →
Name of this SimObject, either the language-independent name for scripting purposes or the localized name for display to user.
The language-independent name should be the same as the English version but
capitalized and with spaces and dashes replaced by underscore,
The name should give an idea of the role of the SimObject in the simulation. This allows us to to treat an object in a special way depending on its name. For example, we might use the name to decide what type of DisplayObject to create to represent the SimObject.
this.nameEquals( name ) →
Whether this SimObject has the given name, adjusting for the transformation to a
language-independent form of the name, as is done by
this.setExpireTime( time ) →
Sets the expiration time, when this SimObject should be removed from the SimList. This is intended for temporary SimObjects that illustrate, for example, contact forces or collisions.
this.similar( obj, opt_tolerance ) →
Returns true if the given SimObject is similar to this SimObject for display
purposes. SimObjects are similar when they are the same type and nearly the same size
and location. Mainly used when showing forces - to avoid adding too many objects
to the display. See
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
toStringShort() on a DisplayShape might return something like