In CindyLab a spring is very similar to a Rubber Band. A spring is constructed by a press/drag/release sequence as in Add a Line mode. If the endpoints of the spring segment are not already present in the drawing, free mass-objects will be added. A spring causes forces to act on its two endpoints. Unlike rubber bands, springs have a resting length at which the force is zero. If the distance between the two endpoints is smaller than the resting length, the force will be repulsive. If it is larger than the resting length, the force will be attractive. The force is calculated by the formula

force = springconstant · |lengthrestlength|

Here |x| denotes the absolute value of x, springconstant is a characteristic constant of the spring that can be adjusted in the inspector, restlength is the resting length of the spring, and length is the distance between the two points. Springs are very powerful objects that admit many variations via the inspector. So we will first have a look at the inspector before we discuss the various possibilities for defining a spring.

Inspecting Springs

The spring inspector comes with a great variety of possibilities for modification. We will discuss these modifications one by one.

The spring inspector

Spring Strength

The spring strength slider helps in adjusting the value of springconstant. No matter what kind of interaction is modeled by the spring, the springconstant acts as a factor by which the final force is multiplied. Thus setting this slider to a value of zero is equivalent to removing the spring from the configuration.

Spring Type

In CindyLab all interactions between pairs of points are internally modeled as springs. Thus it is simple to switch between the different types of interaction. This can be done by choosing the springtype in the inspector. Currently, there are four different types of interaction implemented. Each of them comes with a specific behavior (and formula) for the spring.

The four types are defined as follows:

rubber band: For this spring type it is assumed that the spring has a rest length of zero. Thus the force between the two masses is always attractive. Its absolute value is calculated by the formula

force = springconstantlength.

This type is the default spring type when a Rubber Band is added.

Spring: For this spring type it is assumed that the spring has a positive resting length. Thus the force between the two masses will be attractive if the two masses are farther apart than the resting length. It will be repulsive if they are closer than the resting length. The absolute value of the force is calculated by the formula

force = springconstant ∗ (lengthrestlength)

This type is the default type when a spring is added.

Newton force: This spring type models the gravitational attraction between two bodies. This force depends on the masses of the bodies and the distance between them. It is always attractive. The absolute value of the force is calculated by the formula

force = springconstantmass1mass2 / dist²

Coulomb force: This spring type models the interaction between electrically charged particles. This force depends on the charges of the particles and on the distance between them. It is attractive if the charges have opposite signs and repulsive otherwise. The absolute value of the force is calculated by the formula

force = springconstant * charge1 * charge2 / dist²

This type is the default spring type when a Coulomb Force is added.


The two items Restlength from picture and Length at rest are relevant only if the spring has a resting length.

If Restlength from picture is checked, then the resting length of the spring is defined to be the length of the spring in the drawing when the simulation is started. Thus in this case, a single spring with two mass-objects not otherwise connected at the endpoints exerts no force on the masses.

If this box is not checked, the spring's resting length will be defined by the Length at rest value in the inspector.

Spring Actuation

The two items Amplitude and Phase will be relevant only if the spring has a resting length. In this case, CindyLab provides the possibility to vary the resting length periodically in time. The resting length is then modulated by a sine function, causing it to become periodically longer and shorter.

The amplitude of the resting length variation can be adjusted by the Amplitude slider. The phase of the vibration with respect to the other springs can be adjusted by the Phase slider. The speed of the oscillation is globally adjusted in the environment inspector.


Due to their programmatic flexibility, springs can be used in many different circumstances. Here we will present just a few examples and pictures that exemplify the use of springs.

A Bridge
The first example shows a network of springs that simulates the behavior of a bridge. All springs in this example are used with the default physical setup. However, the appearance of the springs has been slightly altered. Usually, springs are rendered as wiggly objects. This feature can be turned off by the render button in the inspector. Furthermore, CindyScript code was added to change the color of the springs according to their interior tension.

A bridge constructed with springs

Double Pendulum
The next example shows the chaotic movement of a double pendulum. Here two springs are connected and one endpoint is fixed to the ground plane. The springconstant is set to a relatively high value so that the springs behave nearly like rigid rods. The picture shows the movement of this double pendulum under the influence of gravity.

The chaotic motion of a double pendulum

Two-Body Movement
The next pictures show two mass particles with initial velocities and their behavior under gravitational forces. For this example, the type of the spring was set to Newton's law. The two mass particles simulate a system of two stars that orbit each other.

Two instances of two-body motion

Springs and CindyScript

Like any CindyLab object, a spring provides several fields that can be read and very often set by CindyScript. The following list shows the accessible fields for springs:

lnoreal current length of the spring
lrestyesreal resting length of the spring
ldiffnoreal current length difference to the resting length
potentialnoreal the potential energy of the spring
penoreal the potential energy of the spring
strengthyesreal the spring constant
amplitudeyesreal the amplitude of actuation
phaseyesreal the phase of actuation
simulateyesbool turn on/off simulation for this spring

Contributors to this page: Kortenkamp , Richter and Kohler .
Page last modified on Friday 26 of August, 2011 [15:27:56 UTC] by Kortenkamp.

The content on this page is licensed under the terms of the License.

free viagra samplehentai girlsmature pussymilfseeker cialis samplescam clip movie nude webcammother incest order viagra online cialis ukanime rapeparis hilton phone numbers viagra alternatives cialis forum cialis free samplehot girls in pantiesmonster of cocks discount cialis cilias free viagra samplesfree chat rooms cilia structurefree cartoon sex comics buy cialis order viagrafree adult videosplump girl gallerypantyhose gallerycum on her face cheapest cialisbisexual moviestampa bukakehuge black cock thumbnails buy cialis onlineporn star cialis drugwomen having sex cheap generic viagra alternative to viagra natural viagra cheap viagraoral sexteen webcam strip videosnude spanish girlserotic sex cams movies viagra side effectscartoon adultdisney sex animenude blonde hairygang bang swinger cialis viagrabisexual free moviesgay twinkswebcam chat live xxxyoung teens order cialislatina girls thongscum loversjapanese girl viagra cheapyoung japanese girlsmr chews asian beavergangbang squadshoshone indiansmature wiveslive webcam chat girlsfree ebony viagra on lineasian ladyboysteen boys viagra pillsself bondage techniques cailisincest familyfree ebony cheap cialisgay amateur cialis genericbusty asian viagra onlinemature breasts viagra for women free viagrabig boobies cialis generic viagragloryhole gaylatinas in thongs female viagraindian tits viagra 6 free samplesamateur upskirt viagra alternativefree xxx video cialis online discountgalleries of teen girls cialis dosage cheap generic cialisparis hilton pornopussy cat dollsbrutal sexgay peopleblack milfsno tits discount viagrablonde hairy pussyshemale animefree hardcore moviesmom strips for sonfat titscelebrity legsdouble anal levitra vs cialis cialis tadalafil cialis cheapgay bdsmcelebrities exposed viagra generic alternatives to viagra viagra canadabestialitypink porn stars viagra jokesclips of teen sexchicks suck horse cock online viagrasex with horsespainful analglory holes floridafree american bukkake cialis online buy viagrabig cock cum free cialisteen gay porn cialis side effects herbal viagra best price viagra purchase cialis cialis soft tabs cialis vs viagrafree fat girl webcamfree porn movie clipsoral penis suckingebony hardcore viagra pricepantyhose crossed legs cialis and levitralesbiennesblonde boobs buy viagra online