Generate Peano Curve
The Peano Curve Generator lets you visualize and render the historic Peano space-filling curve — one of the most mathematically significant curves ever discovered. Using an L-system rewrite engine based on intertwined X and Y symbol substitution rules, this tool iteratively constructs the curve at any depth you choose, then draws the result on a configurable canvas. At each iteration, the curve grows more intricate, eventually filling every point of a unit square with a continuous, non-self-intersecting path. Whether you are a mathematics student exploring fractal geometry, a developer prototyping generative art, a designer hunting for dense geometric patterns, or an educator preparing visual aids for a topology or calculus class, this tool gives you immediate, hands-on access to one of mathematics' most beautiful constructions. You can fine-tune canvas dimensions, choose your iteration depth, select line and background colors, and control stroke thickness — then export the result for use in presentations, wallpapers, educational materials, or creative projects. The tool runs entirely in your browser with no installation required, making it an ideal companion for anyone curious about recursive structures, space-filling mathematics, or algorithmic art.
Peano Curve's Options
Color Settings
Size and Padding
Round the corners of Peano curve's line segments.Output (Peano Curve)
What It Does
The Peano Curve Generator lets you visualize and render the historic Peano space-filling curve — one of the most mathematically significant curves ever discovered. Using an L-system rewrite engine based on intertwined X and Y symbol substitution rules, this tool iteratively constructs the curve at any depth you choose, then draws the result on a configurable canvas. At each iteration, the curve grows more intricate, eventually filling every point of a unit square with a continuous, non-self-intersecting path. Whether you are a mathematics student exploring fractal geometry, a developer prototyping generative art, a designer hunting for dense geometric patterns, or an educator preparing visual aids for a topology or calculus class, this tool gives you immediate, hands-on access to one of mathematics' most beautiful constructions. You can fine-tune canvas dimensions, choose your iteration depth, select line and background colors, and control stroke thickness — then export the result for use in presentations, wallpapers, educational materials, or creative projects. The tool runs entirely in your browser with no installation required, making it an ideal companion for anyone curious about recursive structures, space-filling mathematics, or algorithmic art.
How It Works
Generate Peano Curve produces new output from rules, parameters, or patterns instead of editing an existing document. That makes input settings more important than input text, because the settings are what define the shape of the result.
Generators are only as useful as the settings behind them. When the output seems off, check the count, range, delimiter, seed values, or pattern options before judging the result itself.
All processing happens in your browser, so your input stays on your device during the transformation.
Common Use Cases
- Explore one of the earliest and most important space-filling curves discovered in mathematical history.
- Generate dense, grid-like geometric patterns for use as backgrounds in web design or print media.
- Visualize how a recursive L-system rewrite process progressively fills a two-dimensional square.
- Create educational diagrams and animated walkthroughs for university-level topology or real analysis courses.
- Prototype generative art pieces that use mathematically precise curves as compositional elements.
- Compare iteration depths side by side to demonstrate how fractal complexity scales with recursion level.
- Produce high-resolution canvas exports for inclusion in research papers, posters, or conference presentations.
How to Use
- Select your desired iteration depth — start with 1 or 2 to understand the basic structure before increasing complexity, since higher depths render significantly more detail.
- Set the canvas width and height to match your intended output size; larger canvases paired with higher iteration depths produce sharper, more detailed renderings.
- Choose a line color and background color using the color pickers to create contrast that suits your purpose — high contrast works best for educational use, while softer palettes suit decorative work.
- Adjust the stroke thickness to control how dense the final image appears; thinner strokes reveal more of the underlying structure at high iterations, while thicker strokes produce bolder graphic results.
- Click the render or generate button to execute the L-system substitution and draw the curve on the canvas.
- Once satisfied with the result, copy or download the rendered image for use in your project, presentation, or design workflow.
Features
- L-system rewrite engine faithfully implements Peano's intertwined X/Y substitution rules, producing mathematically accurate curves at every iteration.
- Configurable iteration depth lets you explore the curve from its simplest first-order form up to highly detailed, dense renderings that approach true space-filling behavior.
- Independent canvas width and height controls allow you to target any output resolution or aspect ratio.
- Line and background color pickers give you full control over the visual style, supporting everything from high-contrast educational diagrams to subtle decorative palettes.
- Adjustable stroke thickness so you can choose between fine wireframe-style rendering and bold graphic outputs.
- Runs entirely client-side in the browser — no server uploads, no installation, and no data is sent anywhere.
- One-click copy or export of the finished canvas image for immediate use in external tools and documents.
Examples
Below is a representative input and output so you can see the transformation clearly.
Order: 0 Size: 100 Angle: 90
Path: (0,0) (100,0)
Edge Cases
- Very large inputs can still stress the browser, especially when the tool is working across many numbers. Split huge jobs into smaller batches if the page becomes sluggish.
- Empty or whitespace-only input is technically valid but may produce unchanged output, which can look like a failure at first glance.
- If the output looks wrong, compare the exact input and option values first, because Generate Peano Curve should be repeatable with the same settings.
Troubleshooting
- Unexpected output often means the input is being split or interpreted at the wrong unit. For Generate Peano Curve, that unit is usually numbers.
- If a previous run looked different, check for hidden whitespace, changed separators, or a setting that was toggled accidentally.
- If nothing changes, confirm that the input actually contains the pattern or structure this tool operates on.
- If the page feels slow, reduce the input size and test a smaller sample first.
Tips
Start at iteration depth 1 or 2 to build intuition for how the rewrite rules produce turns and segments, then increase the depth to watch the curve fill the square more completely. At higher iteration depths (5+), reduce stroke thickness significantly to avoid the lines merging into a solid block of color — a thickness of 1px often works best for deep iterations. For the most visually striking results, try a dark background with a bright or neon line color, which makes the recursive structure pop. If you are using the output in a printed document, increase canvas size proportionally before rendering rather than scaling up a small image after the fact, which would introduce blurriness.
Frequently Asked Questions
What is a Peano curve?
A Peano curve is a specific type of space-filling curve first described by Italian mathematician Giuseppe Peano in 1890. It is a continuous, surjective function that maps the unit interval onto the unit square, meaning its path passes through every single point in a two-dimensional area. The curve is defined as the limit of an infinite recursive process, with each iteration producing a more intricate winding path that covers the square more densely. It was historically significant as the first mathematical proof that a curve could fill an entire area.
How does the L-system rewrite process generate the Peano curve?
An L-system (Lindenmayer system) generates the curve by starting with a short string of symbols — typically X or Y — and repeatedly applying substitution rules that replace each symbol with a longer string of symbols and drawing commands. For the Peano curve, two intertwined rules govern X and Y symbols, and each application of the rules encodes a finer level of the curve's recursive structure. After a chosen number of iterations, the resulting string is interpreted as turtle-graphics commands (move forward, turn left, turn right), which are drawn on a canvas to produce the visible curve.
What is the difference between the Peano curve and the Hilbert curve?
Both are space-filling curves, but they differ in their recursive structure and visual appearance. The Hilbert curve divides space using a 2×2 grid at each iteration, giving it a smoother, maze-like quality, while the Peano curve uses a 3×3 grid, resulting in a denser, more grid-like pattern. The Hilbert curve is simpler to implement and more widely used in computer science applications such as spatial indexing. The Peano curve was discovered first (1890), with the Hilbert curve following a year later in 1891. Both converge to fill the entire unit square in the mathematical limit.
What iteration depth should I use for best results?
For learning and exploration, iterations 1 through 3 are ideal because you can clearly see the recursive structure building up. Iterations 4 and 5 produce visually rich, dense patterns suitable for decorative use. Beyond iteration 5, the curve becomes so dense that individual segments may merge unless you use a very small stroke thickness and a large canvas. For most practical and aesthetic purposes, iterations 3 to 5 offer the best balance between visual complexity and clarity.
Can I use the generated Peano curve image for commercial projects?
The Peano curve itself is a mathematical construction in the public domain — it has been known since 1890 and is not subject to intellectual property restrictions. The image you generate using this tool is your own creation, shaped by your choices of color, size, and iteration depth. You are free to use the output in personal, educational, and commercial projects. Always review the specific terms of service of the platform if you are uncertain about usage rights for tool-generated content.
Why does the curve look like a grid or maze at higher iterations?
The grid-like appearance at higher iterations is a direct consequence of the Peano curve's 3×3 recursive subdivision structure. Each segment of the curve is replaced by a miniature version of the whole pattern, aligned along horizontal and vertical axes, which produces the characteristic rectilinear, grid-filling appearance. This contrasts with curves like the Koch snowflake or Gosper curve, which use diagonal elements and produce more organic-looking shapes. The orthogonal nature of the Peano curve makes it particularly suited for grid-based design applications.
Does a space-filling curve actually have infinite length?
Yes — in the mathematical limit, a true space-filling curve has infinite length, even though it is continuous and bounded within a finite region. Each iteration of the Peano curve multiplies the total path length by a factor of 9, so as the number of iterations approaches infinity, the length grows without bound. This is one of the counterintuitive properties that made space-filling curves so surprising when Peano first published his construction. The finite iterations generated by this tool, of course, have finite length, but the length grows rapidly with each step.
Are space-filling curves used in real-world computer science applications?
Yes, space-filling curves have important practical applications in computer science. Because they map two-dimensional coordinates to a one-dimensional index while preserving spatial locality, they are used in geographic information systems (GIS) to build efficient spatial indexes (such as in R-tree and Z-order curve implementations). They also improve cache performance in matrix operations and image processing by ensuring that spatially nearby data points are also nearby in memory. The Hilbert curve variant is most commonly used for these purposes, but the Peano curve shares the same fundamental locality-preserving property.