Generate Moore Curve

The Moore Curve Generator lets you render high-quality Moore curve fractals at any iteration depth, directly in your browser. The Moore curve is a closed, continuous space-filling fractal derived from the Hilbert curve — but with one crucial difference: it forms a complete loop, returning to its starting point after traversing every cell in a grid. This makes it uniquely valuable for applications where a closed path matters, such as scanning algorithms, circuit board trace routing, and looping animations. Using this tool, you can control the iteration depth to increase the curve's complexity, adjust the canvas size to fit your project's dimensions, and fine-tune the line color, background color, and stroke thickness for pixel-perfect results. Whether you're a mathematician visualizing space-filling geometry, a developer exploring locality-preserving data structures, a generative artist building recursive visual patterns, or a student studying fractal theory, this generator handles the complex L-system grammar computations so you can focus on the output. Simply configure your parameters, generate the curve, and copy or save the result for use in your work.

Options
Moore Curve's Options
Moore curve's width.
Moore curve's height.
Colors
Moore curve's background color.
Moore curve's line color.
Curve
Output (Moore Curve)

What It Does

The Moore Curve Generator lets you render high-quality Moore curve fractals at any iteration depth, directly in your browser. The Moore curve is a closed, continuous space-filling fractal derived from the Hilbert curve — but with one crucial difference: it forms a complete loop, returning to its starting point after traversing every cell in a grid. This makes it uniquely valuable for applications where a closed path matters, such as scanning algorithms, circuit board trace routing, and looping animations. Using this tool, you can control the iteration depth to increase the curve's complexity, adjust the canvas size to fit your project's dimensions, and fine-tune the line color, background color, and stroke thickness for pixel-perfect results. Whether you're a mathematician visualizing space-filling geometry, a developer exploring locality-preserving data structures, a generative artist building recursive visual patterns, or a student studying fractal theory, this generator handles the complex L-system grammar computations so you can focus on the output. Simply configure your parameters, generate the curve, and copy or save the result for use in your work.

How It Works

Generate Moore 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

  • Visualize closed-loop space-filling curves for mathematics courses or academic presentations on fractal geometry.
  • Compare the Moore curve against the standard Hilbert curve to understand how mirrored L-system replacements alter path topology.
  • Generate looping path motifs for generative art projects, textile design, or tile patterns where a seamless closed curve is aesthetically important.
  • Prototype spatial indexing algorithms that benefit from a closed traversal order, ensuring the start and end points of a scan are adjacent.
  • Illustrate how a 2D grid can be traversed in a single continuous stroke for educational demos on space-filling curves and locality preservation.
  • Create SVG or canvas-based Moore curve backgrounds or decorative elements for websites, posters, and data visualization dashboards.
  • Explore the recursive structure of L-system grammars by observing how each iteration depth multiplies the curve's detail and path length.

How to Use

  1. Set the iteration depth using the depth control — lower values (1–3) produce simple, recognizable loop shapes, while higher values (4–7) generate dense, intricate space-filling patterns.
  2. Enter your desired canvas width and height in pixels to match your target output dimensions, whether you need a square tile or a rectangular banner.
  3. Open the line color picker and choose a stroke color that suits your design; select a contrasting background color to make the curve's geometry stand out clearly.
  4. Adjust the line thickness slider to control stroke weight — thin lines reveal fine detail at high iterations, while thicker lines create bolder, print-ready graphics.
  5. Click the Generate button to render the Moore curve onto the canvas using the configured parameters.
  6. Once rendered, copy the image or save it for use in your art, presentations, research documents, or software projects.

Features

  • Full Moore curve rendering engine based on mirrored Hilbert L-system grammar, accurately producing a closed loop that returns to its starting cell.
  • Adjustable iteration depth from 1 to 7+, allowing you to explore everything from the basic four-cell loop to highly complex, grid-filling fractal paths.
  • Custom canvas size controls so you can produce output at any resolution — from small thumbnails to large print-quality renders.
  • Dual color pickers for both line stroke and background, giving you complete control over the visual appearance of the generated curve.
  • Stroke thickness slider that lets you balance visual clarity and detail, particularly useful when rendering high-iteration curves at large sizes.
  • Instant in-browser rendering with no server calls, ensuring fast previews as you experiment with different parameter combinations.
  • Copy-to-clipboard or save functionality so you can immediately use the rendered Moore curve in external applications, presentations, or code.

Examples

Below is a representative input and output so you can see the transformation clearly.

Input
Order: 0
Size: 100
Angle: 90
Output
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 Moore 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 Moore 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

For the clearest results at high iteration depths, increase your canvas size proportionally — a depth-6 Moore curve needs significantly more pixels to remain legible than a depth-3 one. A good rule of thumb is to use a canvas at least 2^n × 16 pixels wide for iteration depth n. When comparing the Moore curve to the Hilbert curve, try rendering both at the same depth and canvas size side by side; the closed-loop nature of the Moore variant becomes immediately visible because its start and end points are adjacent. If you're using the output in generative art or animation, the closed-loop property means you can animate a point traveling along the path and it will loop seamlessly — something the standard Hilbert curve cannot do.

The Moore curve is one of the most elegant objects in the study of space-filling fractals. First described by Eliakim Hastings Moore in 1900, it is a continuous, closed curve that, in its limit, passes through every point in a unit square without crossing itself. Like all space-filling curves, it challenges the intuition: a one-dimensional path, when folded infinitely, can fill a two-dimensional area. What distinguishes the Moore curve from its close relative, the Hilbert curve, is its topology — the Moore curve is a closed loop, meaning its endpoint coincides with its starting point. **How the Moore Curve is Constructed** The Moore curve is generated using an L-system (Lindenmayer system), a formal grammar that applies rewriting rules to an initial string of symbols. Each symbol maps to a drawing instruction — move forward, turn left, turn right — and the grammar is applied recursively for each iteration. The Moore curve's grammar is a specific variant of the Hilbert curve grammar in which four Hilbert curve quadrants are rotated and mirrored such that the end of one quadrant connects back to the start of the whole curve. At iteration 1, the result is a simple square loop. At iteration 2, each of the four sides of that square is replaced by a more complex sub-path, and the process repeats. By iteration 6 or 7, the curve fills its bounding grid so densely it appears as a solid block of lines. **Moore Curve vs. Hilbert Curve** The Hilbert curve and Moore curve are often discussed together because they share the same underlying L-system logic — the Moore curve is essentially four Hilbert curves joined at their endpoints. The key distinction is path closure. The Hilbert curve is an open path: it starts in one corner of the grid and ends in an adjacent corner, but these two points are not the same. The Moore curve, by contrast, is a closed path: the last move of the drawing sequence returns the cursor to the exact starting cell. This seemingly small difference has significant practical implications. In scanning applications — such as image processing, spatial data indexing, or antenna design — a closed traversal can be preferable because it avoids edge effects at the boundary between the start and end of a scan. **Applications in Computing and Design** Space-filling curves like the Moore curve have real-world utility beyond pure mathematics. In spatial data structures, Hilbert and Moore curve orderings are used to map 2D grid coordinates to a 1D index in a way that preserves locality — nearby points in 2D space tend to have nearby indices in 1D. This property is exploited in database indexing, GIS systems, and cache-efficient matrix traversal. The closed-loop nature of the Moore curve makes it particularly attractive for applications where the data is processed cyclically. In generative art and visual design, the Moore curve produces visually striking recursive patterns with a satisfying sense of self-similarity. Textile designers have used it for weaving and embroidery patterns; graphic designers use it as a background motif or logo element. Animators use the closed path as a travel route for moving objects, since the loop allows seamless repetition. In hardware design, space-filling curves appear in fractal antenna design, where the compact, space-filling geometry allows a long electrical path to fit within a small physical footprint — increasing gain and bandwidth at reduced sizes. **Why Iteration Depth Matters** Each additional iteration of the Moore curve quadruples the number of line segments and roughly doubles the visual complexity. Depth 1 has 4 segments; depth 2 has 16; depth 6 has 4,096. This exponential growth means that rendering depth 7 or 8 requires both computational resources and a sufficiently large canvas to remain visually meaningful. For most practical and artistic purposes, depths 3–5 offer the best balance of visible fractal detail and rendering performance.

Frequently Asked Questions

What is a Moore curve?

The Moore curve is a type of space-filling fractal curve first described by mathematician E.H. Moore in 1900. It is constructed by joining four rotated and mirrored Hilbert curve segments in a way that forms a continuous, closed loop. In its mathematical limit, the Moore curve passes through every point in a unit square without ever crossing itself. Unlike many fractals, it is not merely self-similar in appearance — it is defined by a precise recursive grammar that guarantees its space-filling property at every iteration.

What is the difference between a Moore curve and a Hilbert curve?

The primary difference is path topology. The Hilbert curve is an open path that starts at one corner of a grid and ends at a different point; it does not form a loop. The Moore curve is a closed path — its endpoint connects directly back to its start point, forming a complete loop. Structurally, the Moore curve is composed of four Hilbert curve quadrants arranged so their endpoints align into a cycle. This makes the Moore curve preferable in applications that require cyclic traversal, such as seamlessly looping animations or closed-loop scanning algorithms.

What does 'iteration depth' mean for a Moore curve?

Iteration depth refers to how many times the recursive L-system grammar has been applied to generate the curve. At depth 1, the curve is a simple square loop with 4 segments. At depth 2, each segment is replaced by a more complex sub-path, yielding 16 segments. Each additional depth multiplies the segment count by 4, so depth 6 produces 4,096 segments. Higher depths produce denser, more intricate space-filling patterns but require a larger canvas and more rendering time to display clearly.

What is an L-system and how does it relate to the Moore curve?

An L-system (Lindenmayer system) is a type of formal grammar used to model recursive and self-similar structures, originally developed to simulate plant growth. It works by repeatedly applying rewriting rules to an initial string of symbols, where each symbol represents a drawing instruction such as 'move forward' or 'turn right.' The Moore curve is generated by a specific L-system grammar that mirrors and rotates the Hilbert curve rules, producing a closed-loop fractal with each iteration. L-systems are widely used in procedural generation, fractal art, and biological modeling.

What are practical applications of the Moore curve?

The Moore curve has applications across mathematics, computer science, and design. In spatial computing, its locality-preserving traversal order is used in 2D data indexing, image processing, and cache-efficient array access patterns. Its closed-loop nature makes it useful for cyclic scanning and seamlessly looping animations. In hardware, space-filling curves inform fractal antenna designs that pack a long electrical path into a compact area. In art and design, the Moore curve's recursive structure provides an elegant, self-similar visual motif for generative artwork, textile patterns, and data visualization backgrounds.

Why does the Moore curve look like a solid block at high iteration depths?

At high iteration depths, the Moore curve's line segments become so numerous and densely packed that they fill the canvas almost completely, leaving very little empty space between adjacent strokes. This is the defining property of a space-filling curve — in the mathematical limit, the curve passes through every point in the bounding square. Visually, this means that beyond about depth 6 or 7, individual segments become hard to distinguish without a very large canvas and thin line width. Reducing stroke thickness or increasing canvas size helps retain visual clarity at high depths.

Can I use the generated Moore curve in commercial projects?

The Moore curve itself is a mathematical construction and is not subject to copyright — the shape belongs to the public domain. Images you generate using this tool are yours to use freely, including in commercial applications. However, the specific rendering software powering this tool may have its own license terms, so it is worth checking the platform's terms of use. For print or scalable use, exporting at high resolution ensures the curve retains its detail when enlarged.

How do space-filling curves help with data locality in computing?

Space-filling curves like the Moore and Hilbert curves map a two-dimensional grid to a one-dimensional sequence in a way that preserves spatial locality — meaning that grid cells that are close together in 2D tend to appear close together in the 1D sequence. This is valuable in database indexing (especially for geospatial data), image compression, and cache-efficient algorithms, because accessing nearby data in memory reduces cache misses. The Moore curve's closed-loop ordering is especially useful when data is processed in a repeating cycle, as the transition from the last element back to the first element is spatially coherent rather than jumping across the grid.