language-independent name of this object
body to attach to start point of the SpringNonLinear2
attachment point in body coords of body1
body to attach to end point of the SpringNonLinear2
attachment point in body coords of body2
length of spring when it has no force
strength of resisting force (default is 8)
attract force constant (default is 6)
minimum potential energy
Static
IDCounter used for naming SimObjects.
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 list of MassObjects being affected by this ForceLaw.
list of MassObjects being affected by this ForceLaw
Returns the RigidBody that start point of the spring is attached to.
the RigidBody that start point of the spring is attached to.
Returns the RigidBody that end point of the spring is attached to.
the RigidBody that end point of the spring is attached to.
Returns a rectangle that contains this SimObject in world coordinates.
rectangle that contains this SimObject in world coordinates
Returns 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.
the expiration time, in time frame of the Simulation clock
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, see Util.toName, nameEquals.
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.
Optional
opt_localized: booleantrue
means return the localized version of the name;
default is false
which means return the language independent name.
name of this SimObject
Whether this implements the MassObject interface.
Whether this implements the MassObject interface.
Whether this SimObject has the given name, adjusting for transformation to the language-independent form of the name, as is done by Util.toName.
the English or language-independent version of the name
whether this SimObject has the given name (adjusted to language-independent form)
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.
the expiration time, in time frame of the Simulation clock
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 SimList.getSimilar.
the SimObject to compare to
Optional
_opt_tolerance: numberthe amount the object components can differ by
true if this SimObject is similar to obj
for display purposes
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.
Generated using TypeDoc
Represents a non-linear spring attached between two MassObjects, generates a Force which depends on how the SpringNonLinear2 is stretched and the masses. The attraction is a gravity-like force that decreases by distance squared and is proportional to the product of the two masses. Damping is proportional to the relative velocity of the two objects.
The force equation is:
The potential energy is the integral of the force:
The minimum PE occurs where the force is zero:
We subtract the minimum PE from the reported PE so that PE is zero at it's minimum.
To attach one end to a fixed point you can attach to an infinite mass MassObject or a Scrim.