Spring-Mass / Verlet
初出 1967 — 数値計算の中核である Verlet 積分は、ルー・ヴェルレ(Loup Verlet)が古典流体の 分子動力学で用いた1967年の研究に由来する(先行例があり、複数回再発見された)。 布・ロープ・ソフトボディの動的なライン表現への応用は、トーマス・ヤコブセンの 2001年 GDC 講演「Advanced Character Physics」によって普及した。年は単一の作品 ではなく積分手法を指す。 · 年表 ↗
コミュニティ・通称 名称 — 命名・エポニムではなく記述的なカテゴリ名。用語の単一の命名者は確認されていない。
ひとことで 質点をバネで結合した物理シミュレーション。布・ロープ・コンストレイントベースの動的なライン表現に使われる。
コード
上のデモの実際のスケッチ(サンドボックスで再現可能)。これで全部です。
spring-mass/index.html
const SEED = Math.floor(Math.random()*1e9);
// Verlet cloth: a grid of point masses linked by distance constraints,
// pinned along the top, settling under gravity. Constraints relaxed
// iteratively (Jakobsen 2001).
let pts = [], cons = [], COLS, ROWS, S;
function setup() {
randomSeed(SEED);
S = Math.min(windowWidth, windowHeight);
createCanvas(S, S);
COLS = 18; ROWS = 18;
const gap = S * 0.045, ox = (S - gap*(COLS-1))/2, oy = S*0.1;
for (let j = 0; j < ROWS; j++)
for (let i = 0; i < COLS; i++) {
const x = ox + i*gap, y = oy + j*gap;
pts.push({ x, y, px: x, py: y, pin: j === 0 && i % 3 === 0 });
}
const idx = (i,j) => j*COLS+i;
for (let j = 0; j < ROWS; j++)
for (let i = 0; i < COLS; i++) {
if (i < COLS-1) cons.push([idx(i,j), idx(i+1,j), gap]);
if (j < ROWS-1) cons.push([idx(i,j), idx(i,j+1), gap]);
}
stroke(120, 200, 255); strokeWeight(S*0.0015); noFill();
}
function draw() {
background(10, 12, 18);
// integrate
const g = S * 0.0006;
for (const p of pts) {
if (p.pin) continue;
const vx = (p.x - p.px) * 0.99, vy = (p.y - p.py) * 0.99;
p.px = p.x; p.py = p.y;
p.x += vx; p.y += vy + g;
}
// relax constraints
for (let k = 0; k < 8; k++) {
for (const [a, b, len] of cons) {
const pa = pts[a], pb = pts[b];
const dx = pb.x - pa.x, dy = pb.y - pa.y;
const d = Math.hypot(dx, dy) || 1e-4;
const diff = (len - d) / d * 0.5;
const ox = dx*diff, oy = dy*diff;
if (!pa.pin) { pa.x -= ox; pa.y -= oy; }
if (!pb.pin) { pb.x += ox; pb.y += oy; }
}
}
// draw mesh
for (const [a, b] of cons) line(pts[a].x, pts[a].y, pts[b].x, pts[b].y);
}仕組み
物体を、自然長を持つバネで結ばれた粒子(質点)としてモデル化し、毎ステップ:(1) 力/バネ解法=各バネで伸縮量から復元力(フックの法則 F=−k·Δx)+減衰を計算し、重力や風などの外力を各質点に加える、(2) 積分=各粒子を更新。Verlet 積分(x_next = x + (x − x_prev) + a·dt²)が安定で前位置に速度を暗黙保持するため人気、(3) 制約緩和=硬いバネの代わりに、粒子対を毎フレーム数回自然長へ押し戻す(位置ベース動力学)と大ステップでも頑健。一部粒子を固定し剛性/減衰を調整すると布・吊りロープ・揺れる構造になる。
パラメータ
stiffness: number — Spring constant k; higher values make the connections more rigid.damping: number — Velocity damping that bleeds energy so the system settles.restLength: number — The natural length each spring relaxes toward.timestep: number — Integration step (Verlet/Euler); smaller is more stable.
系譜
よく組み合わされるアルゴリズム
- Fragment Shader (GLSL) · 3 作品
- Perlin / Simplex Noise · 3 作品
- Boids / Flocking · 2 作品
- Quadtree / Recursive Quad Split · 2 作品
- Plotter-style Hatching · 2 作品
- Particle System · 2 作品
- Voronoi Diagram · 1 作品
- Marching Squares / Contours · 1 作品
- Delaunay Triangulation · 1 作品
- Raymarching with SDFs · 1 作品
- Flow Field / Vector Field · 1 作品
- Bezier / Catmull-Rom Splines · 1 作品
このアルゴリズムを使う作品 (5)
Balance
kelly-milligan-x-amber-vittoria
Cytographia
golan-levin
Memories of Qilin
emily-xie
SKEUOMORPHS
itsgalo
Space Debris [warning]
whalestreet-x-pxlq
最終更新 2026-07-16