Tangent Arcs / String Art
初出 2021 · Dmitri Cherniak — 手法自体は古く——円どうしの外接線の構成は古典幾何学であり、糸掛け(ストリング・ アート)は長く続く工芸である——単一の起源作品はない。生成芸術における代表的な実例は、 ディミトリ・チェルニアックの「Ringers」(2021年、Art Blocks)で、ペグ・半径・ 巻き順をパラメータ化し、張った輪状の線形の一群を生む。 · 年表 ↗
コミュニティ・通称 名称 — Dmitri Cherniak の作品(2021)に見られる技法の記述的な索引ラベル。確立した名ではなく、命名者も未確認。
ひとことで グリッド上に配置したペグ(円)同士の接線円弧を計算して連ねることで、輪ゴム・糸を巻きつけたような形状を作る幾何学的手法。Ringers が代表例。
コード
上のデモの実際のスケッチ(サンドボックスで再現可能)。これで全部です。
tangent-arcs/index.html
const SEED = Math.floor(Math.random()*1e9);
function setup() {
randomSeed(SEED);
const s = Math.min(windowWidth, windowHeight);
createCanvas(s, s);
background('#f5f5f5');
// 1. Place pegs on a grid (slight jitter), random radii.
const N = 4 + Math.floor(random(3));
const pad = s * 0.12;
const cell = (s - pad * 2) / (N - 1);
const pegs = [];
for (let i = 0; i < N; i++) {
for (let j = 0; j < N; j++) {
if (random() < 0.55) continue;
pegs.push({
x: pad + i * cell + (random() - 0.5) * cell * 0.25,
y: pad + j * cell + (random() - 0.5) * cell * 0.25,
r: random(s * 0.015, s * 0.045),
});
}
}
if (pegs.length < 3) { window.location.reload(); return; }
// 2. Choose a tour order (here: by atan2 around centroid → convex-ish wrap).
const cx = pegs.reduce((a, p) => a + p.x, 0) / pegs.length;
const cy = pegs.reduce((a, p) => a + p.y, 0) / pegs.length;
pegs.sort((a, b) => Math.atan2(a.y - cy, a.x - cx) - Math.atan2(b.y - cy, b.x - cx));
// 3. For each adjacent pair compute external tangent points and draw the
// string as straight segments + arcs around each peg.
noFill();
strokeWeight(s * 0.006);
stroke('#222');
const M = pegs.length;
const tangents = [];
for (let k = 0; k < M; k++) {
const a = pegs[k];
const b = pegs[(k + 1) % M];
const [pa, pb] = externalTangent(a, b);
tangents.push({ pa, pb });
}
for (let k = 0; k < M; k++) {
const peg = pegs[(k + 1) % M];
const t0 = tangents[k].pb;
const t1 = tangents[(k + 1) % M].pa;
// straight tangent segment
line(tangents[k].pa.x, tangents[k].pa.y, tangents[k].pb.x, tangents[k].pb.y);
// arc around peg connecting incoming → outgoing tangent.
// p5.arc() draws from start→end clockwise; pick the shorter direction
// by normalising to a0 ≤ a1 with delta ≤ π.
let a0 = Math.atan2(t0.y - peg.y, t0.x - peg.x);
let a1 = Math.atan2(t1.y - peg.y, t1.x - peg.x);
while (a1 < a0) a1 += TWO_PI;
if (a1 - a0 > Math.PI) {
// shorter way is the other direction → flip
const tmp = a0; a0 = a1 - TWO_PI; a1 = tmp;
}
arc(peg.x, peg.y, peg.r * 2, peg.r * 2, a0, a1);
}
// Draw pegs
noStroke(); fill('#222');
for (const p of pegs) circle(p.x, p.y, p.r * 0.4);
}
// External tangent on the right-hand side: returns the pair of points
// where the line is tangent to both circles (same-side tangent).
function externalTangent(a, b) {
const dx = b.x - a.x;
const dy = b.y - a.y;
const d = Math.hypot(dx, dy);
if (d <= Math.abs(a.r - b.r)) return [a, b]; // degenerate
const cos = (a.r - b.r) / d;
const sin = Math.sqrt(Math.max(0, 1 - cos*cos));
// unit vector from a to b
const ux = dx / d, uy = dy / d;
// rotate (cos, sin) by direction
const nx = ux * cos - uy * sin;
const ny = ux * sin + uy * cos;
return [
{ x: a.x + nx * a.r, y: a.y + ny * a.r },
{ x: b.x + nx * b.r, y: b.y + ny * b.r },
];
}仕組み
平面の各位置にペグ(指定半径の円)を置く。「band を巻く」には:(1) ペグを列(経路や外殻的ループ)に並べる、(2) 連続するペア間に、両円の同じ側に接する外接線分を描く(band の直線部)、(3) 各ペグで入出力の接線を円周に沿う円弧でつなぎ、糸が滑らかに回り込むようにする。ペグの順序・半径・巻き方向・開始点を変えて繰り返すと、張った輪状の線形の一群が得られ、これらのパラメータをランダム化することが各出力の個性を生む。
パラメータ
pegCount: number — Number of pegs/anchor points the strings connect.arcRadius: number — Radius of the arcs drawn between pegs.connectionRule: string — Which pegs are joined (e.g. fixed step, nearest, modular).
系譜
よく組み合わされるアルゴリズム
- Plotter-style Hatching · 1 作品
- Modular Assembly / Parametric Character · 1 作品
- Perlin / Simplex Noise · 1 作品
- Geometric / Hexagonal Tiling · 1 作品
このアルゴリズムを使う作品 (3)
最終更新 2026-07-16