search

Class myphysicslab.lab.model.Spring

Provided By
Extends
All Implemented Interfaces

Represents a spring attached between two MassObjects, generates Forces depending on how the Spring is stretched.

Damping is proportional to the relative velocity of the two objects.

To attach one end to a fixed point you can attach to an infinite mass MassObject or a Scrim.

Compress-only mode

The compressOnly argument of the constructor sets the spring to compress only mode which behaves normally if the spring is in compression (the length is less than the rest length) but it temporarily disconnects from the second attachment point during extension (when the length is more than rest length). During extension, the Spring's start point is at the first attachment point on body1, but the end point is rest-length away from start point in the direction of the second attachment point.

new Spring( name, body1, attach1_body, body2, attach2_body, restLength, stiffness, compressOnly )

Parameters
namestring

language-independent name of this object

body1myphysicslab.lab.model.MassObject

body to attach to start point of the Spring

attach1_bodymyphysicslab.lab.util.GenericVector

attachment point in body coords of body1

body2myphysicslab.lab.model.MassObject

body to attach to end point of the Spring

attach2_bodymyphysicslab.lab.util.GenericVector

attachment point in body coords of body2

restLengthnumber

length of spring when it has no force

stiffness(number|undefined)

amount of force per unit distance of stretch

compressOnly(boolean|undefined)

Sets the spring to 'compress only mode' which behaves normally if the spring is in compression but disconnects from the second attachment point during extension.

Instance Methods