Stroke processing
Curve smoothing
open full size ↗Draw on the canvas with the mouse. The gray line is the drawn path shown exactly, one pixel wide; the blue and red lines are its natural and Hobby smoothings. Span sets the resampling length.
Details
Resampling: The drawn path is walked by arc length and one knot is taken per span. Everything the hand wobbled between the knots is discarded there, so the span is the smoothing strength.
Natural curve: A cubic spline through the knots with zero second derivative at the ends, parameterized by chord length so uneven knot spacing does not distort the shape.
Hobby curve: The interpolation METAFONT draws paths with: tangent directions come from a mock-curvature system and control handles from Hobby's velocity function. It swings wider through corners than the natural spline, which is the visible difference between the two.
Both take the same knots, so moving the span slider trades fidelity against smoothness for both at once. The curves are documented on Curves.
Local smoothing
open full size ↗Two curves that cannot move the settled part of a growing stroke: a Catmull-Rom spline (blue) and a cubic B-spline (green). The stability readout shows the largest movement of the settled part per added point; for both it is exactly zero.
Details
Why the others jump: The natural spline and Hobby's curve each solve one system over every knot, so a new knot re-solves the whole curve. The influence decays with distance, but it never reaches zero.
Local support: Each segment of these two depends only on its four surrounding knots. Appending a knot changes the last segments and nothing before them, which the readout measures as exactly zero.
The trade: The Catmull-Rom passes through every knot but is only C1, so its curvature can kink at knots. The B-spline is C2 and smoother, and pays for it by approximating the knots instead of passing through them, visibly cutting the corners.
Stroke splitting
open full size ↗A drawn line split into separate strokes wherever its direction turns more than a threshold angle. Fast zigzag squiggling becomes a run of short strokes instead of one folded line. Each piece is smoothed on its own, so a corner ends one curve and starts the next instead of being rounded away.
Details
Turn over a window: The turn at a point compares the incoming and outgoing directions, each measured over a fixed arc window rather than one segment, so the jitter of dense points does not trigger cuts.
One cut per corner: A cut cannot follow another within the window's arc, so a sharp corner yields exactly one cut. The boundary point is shared by both pieces, so the strokes stay connected end to end.
Smoothed brush
open full size ↗The same smoothing, drawn as a stroke instead of a line: the smoothed path feeds the brush renderer with ragged ends. The dropdown selects among all four curves.
Details
Rendering: The smoothed polyline becomes the stroke's control points, so a processed path draws with any renderer unchanged.
Span: A span of zero disables the resampling: every drawn point is a knot, and the stroke follows the hand exactly.
Split brush
open full size ↗The stroke splitting, drawn as strokes instead of lines: each split piece feeds the brush renderer as its own stroke, with its own taper, ragged ends, and colors. Fast zigzag squiggling lays down a run of separate brush marks in one gesture. Every try-drawing demo and the drawing tool split strokes this way.
Details
Per-piece processing: Each piece is resampled and smoothed on its own before rendering, so a corner ends one tapered stroke and starts the next instead of being rounded away.
Held start
open full size ↗The first few points of a stroke swing the tangent with every sample, so a mark drawn from the first point flickers through directions before it settles. Each piece is held until it carries enough arc for a stable direction, then appears already settled; the thin black line shows the pointer meanwhile. The stroke splits at sharp turns as in the drawing demos, and a fresh piece after a split waits the same way its stroke did. Every drawing demo now runs this gate.
Details
The gate: hasSettledStart walks the drawn points and passes once the accumulated arc reaches a threshold. Distance, not a point count: a slow hand piles points onto one spot without adding direction.
hasSettledStartは描かれた点をたどり、積算した弧長がしきい値に達したら通します。点の数ではなく距離で判定します。ゆっくり動く手は、向きの情報を足さないまま、一点に点を積み上げるからです。A gesture released below the threshold draws nothing, and a piece split off below it stays hidden until its own arc passes.
Width smoothing
open full size ↗Smoothing that follows the stroke's width: a narrow stroke follows the hand directly, and a wide one rounds its turns. A sharp turn folds a wide ribbon over itself, so the wider the stroke, the earlier the turns are rounded away; drawn thin, the same gesture keeps its corners. Every drawing demo now smooths this way.
Details
The rule: smoothByWidth spaces the smoothing knots at width × gain, clamped to a working range, and interpolates them with the local Catmull-Rom, so the settled part of a growing stroke holds still.
smoothByWidthは、平滑化のノットを幅×gainの間隔で置き(動作レンジに収めます)、局所的なCatmull-Romで補間します。そのため、伸びていくストロークのすでに描かれた部分は動きません。The black pointer line stays unsmoothed, so the gap between the hand and the mark shows the smoothing at work: none when thin, wide arcs when thick.
Blob drawing
open full size ↗Draw a line and it becomes a filled blob that contains the whole gesture: the smallest convex region around every drawn point, smoothed and painted.
Details
The hull: The convex hull of the drawn points is the smallest convex region containing all of them. Its perimeter is resampled at the span for even knots, and the closed Catmull-Rom or B-spline rounds it into a blob.
Containment: Smoothing cuts inside the hull, so each knot is pushed outward along its edge normal by a fraction of the span. The curve then still contains every drawn point.
Filling: The closed polyline becomes a THREE.Shape and its triangulation fills the area.
Tight blob
open full size ↗A blob that stays a blob and still keeps its concavities: the drawn path is closed into a smooth loop, and the shape is everything within a radius of that loop.
Details
Closing first: The path knots feed the closed spline, so the gesture becomes an enclosed loop before the offset. Without this, an open stroke offsets into a tube that follows the line; with it, the result is always a mass. The offset's distance field does not care if the closure crosses the stroke, so any gesture closes safely.
The outline: The distance field to the closed loop is stamped onto a grid, and the radius contour is extracted with marching squares. Its outer boundary keeps the loop's concavities, where the convex hull above spans them.
Smoothing: The contour is resampled at the span and rounded by the closed Catmull-Rom or B-spline. The contour already sits the radius out from the path, so the smoothing has room to cut inward without excluding any drawn point.
Radius: Small, the blob reads as a tube around the line; large, the concavities fill in and it approaches the hull.