Skip to content

fractal

23 motifs. Import them from geomotif.motifs, or build one by name with registry.create("fractal.apollonian").

fractal.apollonian

fractal.apollonian

Circles packed into circles, filling every gap they leave.

from geomotif import save_svg
from geomotif.motifs import ApollonianGasket

motif = ApollonianGasket()
save_svg(motif.build(), "fractal.apollonian.svg", width=320, height=320)
geomotif render fractal.apollonian --out fractal.apollonian.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.apollonian",
  "params": {
    "depth": 5,
    "radius": 150.0,
    "min_radius": 0.004,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
depth int 5
radius float 150.0
min_radius float 0.004
center Point (0.0, 0.0)

fractal.cantor

fractal.cantor

Take out the middle third. Repeat. Stack the rounds to see it happen.

from geomotif import save_svg
from geomotif.motifs import CantorSet

motif = CantorSet()
save_svg(motif.build(), "fractal.cantor.svg", width=320, height=320)
geomotif render fractal.cantor --out fractal.cantor.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.cantor",
  "params": {
    "depth": 6,
    "width": 240.0,
    "gap": 14.0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
depth int 6
width float 240.0
gap float 14.0
center Point (0.0, 0.0)

fractal.dragon

fractal.dragon

The Heighway dragon: fold a strip of paper in half, repeatedly, unfold.

from geomotif import save_svg
from geomotif.motifs import DragonCurve

motif = DragonCurve()
save_svg(motif.build(), "fractal.dragon.svg", width=320, height=320)
geomotif render fractal.dragon --out fractal.dragon.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.dragon",
  "params": {
    "depth": 10,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 10
step float 1.0
start_angle float 0.0

fractal.gosper

fractal.gosper

The flowsnake: a space-filling curve on a hexagonal grid.

from geomotif import save_svg
from geomotif.motifs import GosperCurve

motif = GosperCurve()
save_svg(motif.build(), "fractal.gosper.svg", width=320, height=320)
geomotif render fractal.gosper --out fractal.gosper.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.gosper",
  "params": {
    "depth": 4,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 4
step float 1.0
start_angle float 0.0

fractal.h-tree

fractal.h-tree

An H whose serifs are smaller H's, and so on down.

from geomotif import save_svg
from geomotif.motifs import HTree

motif = HTree()
save_svg(motif.build(), "fractal.h-tree.svg", width=320, height=320)
geomotif render fractal.h-tree --out fractal.h-tree.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.h-tree",
  "params": {
    "depth": 6,
    "size": 220.0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
depth int 6
size float 220.0
center Point (0.0, 0.0)

fractal.hilbert

fractal.hilbert

The space-filling curve that keeps neighbours together.

from geomotif import save_svg
from geomotif.motifs import HilbertCurve

motif = HilbertCurve()
save_svg(motif.build(), "fractal.hilbert.svg", width=320, height=320)
geomotif render fractal.hilbert --out fractal.hilbert.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.hilbert",
  "params": {
    "depth": 5,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 5
step float 1.0
start_angle float 0.0

fractal.koch

fractal.koch

The original: replace the middle third of every segment with a spike.

from geomotif import save_svg
from geomotif.motifs import KochCurve

motif = KochCurve()
save_svg(motif.build(), "fractal.koch.svg", width=320, height=320)
geomotif render fractal.koch --out fractal.koch.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.koch",
  "params": {
    "depth": 4,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 4
step float 1.0
start_angle float 0.0

fractal.koch-antisnowflake

fractal.koch-antisnowflake

The snowflake with its spikes turned inward, which is a different shape.

from geomotif import save_svg
from geomotif.motifs import KochAntisnowflake

motif = KochAntisnowflake()
save_svg(motif.build(), "fractal.koch-antisnowflake.svg", width=320, height=320)
geomotif render fractal.koch-antisnowflake --out fractal.koch-antisnowflake.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.koch-antisnowflake",
  "params": {
    "depth": 4,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 4
step float 1.0
start_angle float 0.0

fractal.koch-snowflake

fractal.koch-snowflake

Three Koch curves around a triangle: finite area, infinite perimeter.

from geomotif import save_svg
from geomotif.motifs import KochSnowflake

motif = KochSnowflake()
save_svg(motif.build(), "fractal.koch-snowflake.svg", width=320, height=320)
geomotif render fractal.koch-snowflake --out fractal.koch-snowflake.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.koch-snowflake",
  "params": {
    "depth": 4,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 4
step float 1.0
start_angle float 0.0

fractal.levy-c

fractal.levy-c

Paul Levy's C curve: two half-size copies at right angles, forever.

from geomotif import save_svg
from geomotif.motifs import LevyCCurve

motif = LevyCCurve()
save_svg(motif.build(), "fractal.levy-c.svg", width=320, height=320)
geomotif render fractal.levy-c --out fractal.levy-c.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.levy-c",
  "params": {
    "depth": 10,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 10
step float 1.0
start_angle float 0.0

fractal.minkowski

fractal.minkowski

Koch's idea on a square grid: a battlement instead of a spike.

from geomotif import save_svg
from geomotif.motifs import MinkowskiSausage

motif = MinkowskiSausage()
save_svg(motif.build(), "fractal.minkowski.svg", width=320, height=320)
geomotif render fractal.minkowski --out fractal.minkowski.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.minkowski",
  "params": {
    "depth": 3,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 3
step float 1.0
start_angle float 0.0

fractal.minkowski-island

fractal.minkowski-island

Four Minkowski sausages around a square: the quadratic Koch island.

from geomotif import save_svg
from geomotif.motifs import MinkowskiIsland

motif = MinkowskiIsland()
save_svg(motif.build(), "fractal.minkowski-island.svg", width=320, height=320)
geomotif render fractal.minkowski-island --out fractal.minkowski-island.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.minkowski-island",
  "params": {
    "depth": 3,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 3
step float 1.0
start_angle float 0.0

fractal.moore

fractal.moore

Hilbert's curve closed into a loop.

from geomotif import save_svg
from geomotif.motifs import MooreCurve

motif = MooreCurve()
save_svg(motif.build(), "fractal.moore.svg", width=320, height=320)
geomotif render fractal.moore --out fractal.moore.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.moore",
  "params": {
    "depth": 4,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 4
step float 1.0
start_angle float 0.0

fractal.peano

fractal.peano

The first space-filling curve ever published, from 1890.

from geomotif import save_svg
from geomotif.motifs import PeanoCurve

motif = PeanoCurve()
save_svg(motif.build(), "fractal.peano.svg", width=320, height=320)
geomotif render fractal.peano --out fractal.peano.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.peano",
  "params": {
    "depth": 3,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 3
step float 1.0
start_angle float 0.0

fractal.pythagoras-tree

fractal.pythagoras-tree

Squares on the legs of right triangles, all the way up.

from geomotif import save_svg
from geomotif.motifs import PythagorasTree

motif = PythagorasTree()
save_svg(motif.build(), "fractal.pythagoras-tree.svg", width=320, height=320)
geomotif render fractal.pythagoras-tree --out fractal.pythagoras-tree.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.pythagoras-tree",
  "params": {
    "depth": 8,
    "size": 60.0,
    "lean": 0.7853981633974483,
    "base": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
depth int 8
size float 60.0
lean float 0.7853981633974483
base Point (0.0, 0.0)

fractal.sierpinski-arrowhead

fractal.sierpinski-arrowhead

The gasket approached along a curve instead of through a triangle.

from geomotif import save_svg
from geomotif.motifs import SierpinskiArrowhead

motif = SierpinskiArrowhead()
save_svg(motif.build(), "fractal.sierpinski-arrowhead.svg", width=320, height=320)
geomotif render fractal.sierpinski-arrowhead --out fractal.sierpinski-arrowhead.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.sierpinski-arrowhead",
  "params": {
    "depth": 6,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 6
step float 1.0
start_angle float 0.0

fractal.sierpinski-carpet

fractal.sierpinski-carpet

A square with its middle ninth removed, then again in each ninth.

from geomotif import save_svg
from geomotif.motifs import SierpinskiCarpet

motif = SierpinskiCarpet()
save_svg(motif.build(), "fractal.sierpinski-carpet.svg", width=320, height=320)
geomotif render fractal.sierpinski-carpet --out fractal.sierpinski-carpet.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.sierpinski-carpet",
  "params": {
    "depth": 4,
    "size": 200.0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
depth int 4
size float 200.0
center Point (0.0, 0.0)

fractal.sierpinski-triangle

fractal.sierpinski-triangle

The gasket, drawn as one unbroken stroke that closes on itself.

from geomotif import save_svg
from geomotif.motifs import SierpinskiTriangle

motif = SierpinskiTriangle()
save_svg(motif.build(), "fractal.sierpinski-triangle.svg", width=320, height=320)
geomotif render fractal.sierpinski-triangle --out fractal.sierpinski-triangle.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.sierpinski-triangle",
  "params": {
    "depth": 5,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 5
step float 1.0
start_angle float 0.0

fractal.terdragon

fractal.terdragon

The dragon done in thirds: one segment becomes three at 120 degrees.

from geomotif import save_svg
from geomotif.motifs import Terdragon

motif = Terdragon()
save_svg(motif.build(), "fractal.terdragon.svg", width=320, height=320)
geomotif render fractal.terdragon --out fractal.terdragon.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.terdragon",
  "params": {
    "depth": 6,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 6
step float 1.0
start_angle float 0.0

fractal.twindragon

fractal.twindragon

Two Heighway dragons back to back, enclosing a region that tiles.

from geomotif import save_svg
from geomotif.motifs import TwinDragon

motif = TwinDragon()
save_svg(motif.build(), "fractal.twindragon.svg", width=320, height=320)
geomotif render fractal.twindragon --out fractal.twindragon.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.twindragon",
  "params": {
    "depth": 9,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 9
step float 1.0
start_angle float 0.0

fractal.vicsek

fractal.vicsek

The box fractal: a plus sign made of plus signs.

from geomotif import save_svg
from geomotif.motifs import VicsekFractal

motif = VicsekFractal()
save_svg(motif.build(), "fractal.vicsek.svg", width=320, height=320)
geomotif render fractal.vicsek --out fractal.vicsek.svg
{
  "geomotif": "1.3.1",
  "motif": "fractal.vicsek",
  "params": {
    "depth": 3,
    "step": 1.0,
    "start_angle": 0.0
  }
}
Parameters
Name Type Default
depth int 3
step float 1.0
start_angle float 0.0

points.barnsley-fern

points.barnsley-fern

Four affine maps and a coin, producing a fern.

from geomotif import save_svg
from geomotif.motifs import BarnsleyFern

motif = BarnsleyFern(count=4000)
save_svg(motif.build(), "points.barnsley-fern.svg", width=320, height=320)
geomotif render points.barnsley-fern --out points.barnsley-fern.svg
{
  "geomotif": "1.3.1",
  "motif": "points.barnsley-fern",
  "params": {
    "count": 4000,
    "size": 300.0,
    "seed": 0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
count int 40000
size float 300.0
seed int 0
center Point (0.0, 0.0)

points.ifs

points.ifs

The chaos game: pick a map at random, apply it, plot the point, repeat.

from geomotif import save_svg
from geomotif.motifs import IFSAttractor

motif = IFSAttractor(count=4000)
save_svg(motif.build(), "points.ifs.svg", width=320, height=320)
geomotif render points.ifs --out points.ifs.svg
{
  "geomotif": "1.3.1",
  "motif": "points.ifs",
  "params": {
    "maps": [
      {
        "$type": "geomotif.motifs.fractals.IFSMap",
        "transform": {
          "$type": "geomotif.core.transform.Affine",
          "a": 0.5,
          "b": 0.0,
          "c": 0.0,
          "d": 0.5,
          "e": 0.0,
          "f": 0.0
        },
        "weight": 1.0
      },
      {
        "$type": "geomotif.motifs.fractals.IFSMap",
        "transform": {
          "$type": "geomotif.core.transform.Affine",
          "a": 0.5,
          "b": 0.0,
          "c": 0.0,
          "d": 0.5,
          "e": 0.5,
          "f": 0.0
        },
        "weight": 1.0
      },
      {
        "$type": "geomotif.motifs.fractals.IFSMap",
        "transform": {
          "$type": "geomotif.core.transform.Affine",
          "a": 0.5,
          "b": 0.0,
          "c": 0.0,
          "d": 0.5,
          "e": 0.25,
          "f": 0.4330127018922193
        },
        "weight": 1.0
      }
    ],
    "count": 4000,
    "size": 240.0,
    "seed": 0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
maps tuple[IFSMap, ...] a tuple
count int 20000
size float 240.0
seed int 0
center Point (0.0, 0.0)