Skip to content
CoreSource checked

Mass-Spring System

Simulates connected particles using spring forces between neighboring masses.

Quick Facts

Compact metadata for implementation and discovery.

Category
Simulation
Difficulty
Intermediate
Family
Particle Simulation
Tier
Core
Status
Verified
Review
Source Checked
Sources
1
Formulas
1
Relationships
3
Code example
Ready
Visualization
Ready

Overview

A Mass-Spring System models elastic structures by applying forces based on how far each spring is stretched or compressed from its rest length.

Core Concepts

spring forcerest lengthparticle massdamping

Quick facts

Complexity

Runtime and memory behavior at a glance.

Best

O(springs)

Average

O(steps * springs)

Worst

O(steps * springs)

Space

O(particles + springs)

When to Use

  • Use when elastic connections can approximate the simulated material.
  • Use when cloth prototypes is a central requirement.

When Not to Use

  • Avoid when physically accurate continuum mechanics is required.
  • Avoid when the timestep, constraints, or stability requirements exceed what the method can handle.

What It Does

  • Stores masses and springs
  • Computes elastic spring forces
  • Integrates particle motion

Use Cases

  • Cloth prototypes
  • Soft-body effects
  • Educational physics simulation

Inputs

  • Particle positions
  • Spring connections
  • Rest lengths
  • Stiffness

Outputs

  • Updated particle positions and velocities

Key Formulas (1)

Hooke's law

force = −stiffness · (currentlength − restlength)
force = -stiffness * (current_length - rest_length)

Computes the restoring force along a spring.

Pseudocode

  1. 1.For each spring, measure current length
  2. 2.Compute force from stretch or compression
  3. 3.Add equal and opposite forces to connected masses
  4. 4.Integrate particle velocities and positions

Canonical Example

Input
two particles connected by rest length 1, current length 1.2
Output
spring pulls particles together
Explanation
The stretched spring creates a restoring force.

Implementation Notes

  • Add damping and clamp timesteps before increasing spring stiffness.
  • Keep units, timestep size, and state variables explicit in tests.
  • Keep a tiny example with expected output beside the implementation.

Common Pitfalls

  • High stiffness with explicit integration can explode numerically.
  • Large timesteps can add energy, damp motion, or make constraints explode.
  • Not defining boundary, empty, or degenerate inputs before implementation.

Interactive Mechanism Walkthrough

Iterative Convergence & State Trajectory

Show particles connected by springs stretching and pulling back toward rest length.

Mass-Spring System mechanism walkthrough step 1 of 4x₀x₁x₂x*
Step 1 of 4: For each spring, measure current length
simulation-state

Notes

Stiff springs usually require small timesteps or implicit methods.

Sources (1)

What each reference supports for this entry.

Physically Based Modeling

Documentation

SIGGRAPH course notes covering integration, particles, constraints, and rigid-body simulation.

Open source

Explore Next

Good next jumps from the relationship graph, ranked for useful discovery.

Cloth simulations often model fabric as a mass-spring network.

Often paired withVerlet Integration

Mass-spring systems are commonly integrated with simple time steppers.

Tags

SimulationPhysicsSpring SystemParticles