Home Tools Blog About

Draw Levy Fractal

In short

Draw the Lévy C-curve (Paul Lévy 1938) - space-filling fractal at 45°. Gradient and segmented modes. Free, offline, client-side, instant, secure.

  • Runs in your browser
  • Nothing uploaded
  • Free, no sign-up

Paul Lévy's 1938 space-filling curve via L-system (axiom F, rule F → +F--F+, 45° turns).

🛡
100% PrivateNo server uploads, ever
InstantRuns in your browser
💧
No WatermarksClean output, always
🆓
Free ForeverNo accounts, no limits

How to Use Draw Levy Fractal

Draw Levy Fractal · free online tool · All Tools Verse
Draw Levy Fractal. Free online tool that runs in your browser.
  1. Pick iteration level (1-14). Each iter doubles segment count: iter N = 2^N. Iter 11 = 2,048 (default), iter 14 = 16,384. Iter ≥ 13 triggers the "Drawing…" loading state.
  2. Choose render mode: Continuous (single primary-color stroke), Gradient (primary → secondary lerp along traversal), Segmented (alternating per segment for high-contrast self-similarity demos).
  3. Pick colors. Primary (always used) + secondary (gradient and segmented only). Low-contrast primary-vs-background triggers an info-toast warning.
  4. Set canvas size and background. HiDPI-aware (backing store × DPR for crisp Retina). Background: white, black, or transparent.
  5. Adjust line width (1-5 px). Thinner lines (1-2 px) work better for iter 12+ to avoid the curve becoming a solid blob.
  6. Press Ctrl+Enter (or Cmd+Enter on Mac) or click Draw. Stats show: segments, dimension (2.0 - space-filling), iteration, total path length, L-system char count, render time.
  7. Copy or Download. Copy puts PNG bytes on clipboard via ClipboardItem. Download saves levy-c-curve-iter-N.png.

Frequently Asked Questions

What is the Lévy C-curve?

Discovered by French mathematician Paul Lévy in 1938 (full name: Paul Pierre Lévy, 1886-1971; not the same as Pierre Léonidas Lévy who studied dragon curves). Defined by an L-system with axiom F and rule F → +F--F+ at 45° turns. Each iteration doubles the segment count. The limit set is truly space-filling (dimension 2) with strong self-overlap – the curve passes through the same plane region multiple times. Named “C-curve” because at iter 6-10 it resembles the letter C or a curled dragon.

Why is dimension exactly 2?

Self-similarity formula: dim = log(N)/log(S) where N copies are placed at scale 1/S. Lévy: each F is replaced by 2 F’s via the rule (after +/- turns cancel through the recursive expansion), placed at scale 1/√2 each (45° turn creates a √2 hypotenuse split into 2 half-length sub-segments). So dim = log(2)/log(√2) = log(2)/((1/2) log(2)) = 2. Dimension 2 = truly space-filling.

How does it differ from the Heighway dragon?

Both are 2D space-filling curves with dimension 2. Heighway dragon (1966, NASA): paper-folding construction, 90° turns, rule X → X+YF+, Y → -FX-Y. Lévy C-curve (1938): pure recursion, 45° turns, rule F → +F--F+. Visually: Heighway is more “linear/serpentine”; Lévy is more “curled and overlap-heavy” – its self-overlap is the distinctive feature.

What does “self-overlap” mean here?

The Lévy curve passes through the same 2D points multiple times. Unlike the Hilbert curve (which is self-avoiding – no two distinct curve parameters map to the same 2D point), Lévy’s curve visits some points twice or more in the limit. Mathematically: a measure-preserving but NOT one-to-one map from [0,1] to its 2D image. Practically: when you draw at high iter you see darker regions where the curve doubles back. Useful for understanding the difference between “space-filling” (covers a region) and “self-avoiding” (visits each point once).

Why does the curve look “C-shaped”?

At iter 6-10, the overall envelope of the curve has a distinctive C shape with the opening facing one direction. This is the FIRST-iteration U-fold compounded by all subsequent foldings. Earlier iterations: iter 1 is `+F–F+` which traces a 135° wedge (one V); iter 2 is two V’s at 45°; iter 3 starts to curl. By iter 6 you see the recognizable C. Higher iter (12+) fills in the C shape until you can no longer see the C – it becomes a solid blob.

What does gradient mode reveal?

Color lerps from primary (start) to secondary (end) along the traversal order. Useful to see WHICH PART of the curve is drawn first. You’ll notice that adjacent regions in 2D may have very different colors (drawn far apart in time), and 1D-adjacent segments (similar colors) are usually close in 2D. This visualises locality preservation – though for Lévy it’s WORSE than Hilbert because of the self-overlap.

What does segmented mode show?

Alternates primary/secondary per segment (even/odd index). Useful to see SELF-SIMILARITY: the recursive structure means each iter creates pairs of sub-curves rotated 45° – segmented mode highlights the pair structure visually. Try iter 8-10 with high-contrast colors (e.g. blue + orange) – you’ll see the recursive pair-grouping at every scale.

Why does iter 14 take a moment?

Iter N = 2^N segments. Iter 14 = 16,384 segments. Each is a separate Canvas lineTo call. At ~16k operations + path stroke, render takes 100-500 ms. Iter 15 would be 32k (2× wait). Iter 14 is the comfortable ceiling. The L-system string at iter 14 is ~100k characters (each F → 6 chars, doubling per iter from base “F”).

Is my data secure?

Yes – 100% client-side. L-system expansion and Canvas drawing run in your browser. No parameters or images leave your device. Verify via your browser’s Network tab.

Keep going

Related Tools

All Fractals tools →

Draw Canopy Fractal

Draw a canopy-tree L-system fractal in your browser. 7 iterations, custom colors, gradient depth,…

Draw Cantor Dust Fractal

Draw true Cantor Dust (4-corner) or Sierpiński carpet (8-square) in your browser. Color modes,…

Draw Cantor Fractal

Draw the Cantor set with middle-third deletion. 0-10 iterations, custom colors, dimension and measure…

Draw Flowsnake Fractal

Draw the Gosper curve hexagonal space-filling fractal in your browser. Iterations 1-6, custom colors,…

Draw Frosty Fractal

Draw Frosty Fractal online, free and private. Runs in your browser, no upload, instant…

Draw Hausdorff Fractal

Draw the Hilbert curve or Moore curve (closed-loop variant) - true space-filling fractals (dim…

Draw Heighway Fractal

Draw the Heighway dragon (paper-folding fractal) with fire gradient and symmetry modes. L-system based.…

Draw Hexaflake Fractal

Draw the hexaflake (hexagon snowflake) - 7-hexagon recursive fractal with 6-fold symmetry. Custom colors,…

Draw Hilbert Fractal

Draw the Hilbert space-filling curve in your browser. 9 iterations, rotation, gradient, endpoints. Free,…

Draw Koch Fractal

Draw Koch curve, snowflake, or anti-snowflake at any angle. Iterations 0-7. Free, offline, client-side,…

Draw Mcworter Dendrite Fractal

Draw Mcworter Dendrite Fractal online, free and private. Runs in your browser, no upload,…

Draw Moore Fractal

Draw the Moore curve (Eliakim Moore 1900) - closed-loop space-filling fractal. Start/end markers, 4-fold…

Share

Embed this tool

Add this free tool to your website. Copy and paste the code: