Skip to content

primitive

16 motifs. Import them from geomotif.motifs, or build one by name with registry.create("arc").

arc

arc

Part of a circle: sweep radians of it, starting at start_angle.

from geomotif import save_svg
from geomotif.motifs import Arc

motif = Arc()
save_svg(motif.build(), "arc.svg", width=320, height=320)
geomotif render arc --out arc.svg
{
  "geomotif": "1.3.1",
  "motif": "arc",
  "params": {
    "resolution": null,
    "radius": 100.0,
    "start_angle": 0.0,
    "sweep": 3.141592653589793,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default Notes
radius float 100.0
start_angle float 0.0
sweep float 3.141592653589793
center Point (0.0, 0.0)
resolution int | None None Segments per strand -- a strand gets one more point than that, so both ends are included. None (default) scales density with the winding.

circle

circle

A circle of radius radius around center.

from geomotif import save_svg
from geomotif.motifs import Circle

motif = Circle()
save_svg(motif.build(), "circle.svg", width=320, height=320)
geomotif render circle --out circle.svg
{
  "geomotif": "1.3.1",
  "motif": "circle",
  "params": {
    "resolution": null,
    "radius": 100.0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default Notes
radius float 100.0
center Point (0.0, 0.0)
resolution int | None None Segments per strand -- a strand gets one more point than that, so both ends are included. None (default) scales density with the winding.

egg

egg

An oval fatter at one end than the other.

from geomotif import save_svg
from geomotif.motifs import Egg

motif = Egg()
save_svg(motif.build(), "egg.svg", width=320, height=320)
geomotif render egg --out egg.svg
{
  "geomotif": "1.3.1",
  "motif": "egg",
  "params": {
    "resolution": null,
    "length": 140.0,
    "width": 100.0,
    "taper": 0.25,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default Notes
length float 140.0
width float 100.0
taper float 0.25
center Point (0.0, 0.0)
resolution int | None None Segments per strand -- a strand gets one more point than that, so both ends are included. None (default) scales density with the winding.

ellipse

ellipse

An ellipse with semi-axes rx and ry, optionally rotated.

from geomotif import save_svg
from geomotif.motifs import Ellipse

motif = Ellipse()
save_svg(motif.build(), "ellipse.svg", width=320, height=320)
geomotif render ellipse --out ellipse.svg
{
  "geomotif": "1.3.1",
  "motif": "ellipse",
  "params": {
    "resolution": null,
    "rx": 120.0,
    "ry": 70.0,
    "center": [
      0.0,
      0.0
    ],
    "rotation": 0.0
  }
}
Parameters
Name Type Default Notes
rx float 120.0
ry float 70.0
center Point (0.0, 0.0)
rotation float 0.0
resolution int | None None Segments per strand -- a strand gets one more point than that, so both ends are included. None (default) scales density with the winding.

line

line

A straight segment from start to end.

from geomotif import save_svg
from geomotif.motifs import Line

motif = Line()
save_svg(motif.build(), "line.svg", width=320, height=320)
geomotif render line --out line.svg
{
  "geomotif": "1.3.1",
  "motif": "line",
  "params": {
    "start": [
      0.0,
      0.0
    ],
    "end": [
      100.0,
      100.0
    ]
  }
}
Parameters
Name Type Default
start Point (0.0, 0.0)
end Point (100.0, 100.0)

points.grid

points.grid

A rectangular lattice of loose points, optionally staggered.

from geomotif import save_svg
from geomotif.motifs import PointGrid

motif = PointGrid()
save_svg(motif.build(), "points.grid.svg", width=320, height=320)
geomotif render points.grid --out points.grid.svg
{
  "geomotif": "1.3.1",
  "motif": "points.grid",
  "params": {
    "columns": 12,
    "rows": 12,
    "dx": 20.0,
    "dy": 20.0,
    "stagger": 0.0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
columns int 12
rows int 12
dx float 20.0
dy float 20.0
stagger float 0.0
center Point (0.0, 0.0)

points.poisson

points.poisson

Points scattered at random, but never closer together than a set distance.

from geomotif import save_svg
from geomotif.motifs import PoissonDiscPoints

motif = PoissonDiscPoints()
save_svg(motif.build(), "points.poisson.svg", width=320, height=320)
geomotif render points.poisson --out points.poisson.svg
{
  "geomotif": "1.3.1",
  "motif": "points.poisson",
  "params": {
    "width": 300.0,
    "height": 300.0,
    "min_distance": 20.0,
    "seed": 0,
    "attempts": 30,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
width float 300.0
height float 300.0
min_distance float 20.0
seed int 0
attempts int 30
center Point (0.0, 0.0)

polygon.regular

polygon.regular

A regular sides-gon inscribed in a circle of radius radius.

from geomotif import save_svg
from geomotif.motifs import RegularPolygon

motif = RegularPolygon()
save_svg(motif.build(), "polygon.regular.svg", width=320, height=320)
geomotif render polygon.regular --out polygon.regular.svg
{
  "geomotif": "1.3.1",
  "motif": "polygon.regular",
  "params": {
    "sides": 6,
    "radius": 100.0,
    "center": [
      0.0,
      0.0
    ],
    "rotation": 1.5707963267948966
  }
}
Parameters
Name Type Default
sides int 6
radius float 100.0
center Point (0.0, 0.0)
rotation float 1.5707963267948966

polygon.reuleaux

polygon.reuleaux

A curve of constant width: the Reuleaux triangle and its odd-sided kin.

from geomotif import save_svg
from geomotif.motifs import ReuleauxPolygon

motif = ReuleauxPolygon()
save_svg(motif.build(), "polygon.reuleaux.svg", width=320, height=320)
geomotif render polygon.reuleaux --out polygon.reuleaux.svg
{
  "geomotif": "1.3.1",
  "motif": "polygon.reuleaux",
  "params": {
    "sides": 3,
    "width": 150.0,
    "center": [
      0.0,
      0.0
    ],
    "rotation": 1.5707963267948966
  }
}
Parameters
Name Type Default
sides int 3
width float 150.0
center Point (0.0, 0.0)
rotation float 1.5707963267948966

polygon.star

polygon.star

The {n/k} star polygon: every step-th corner of an n-gon.

from geomotif import save_svg
from geomotif.motifs import StarPolygon

motif = StarPolygon()
save_svg(motif.build(), "polygon.star.svg", width=320, height=320)
geomotif render polygon.star --out polygon.star.svg
{
  "geomotif": "1.3.1",
  "motif": "polygon.star",
  "params": {
    "points": 5,
    "step": 2,
    "radius": 100.0,
    "center": [
      0.0,
      0.0
    ],
    "rotation": 1.5707963267948966
  }
}
Parameters
Name Type Default
points int 5
step int 2
radius float 100.0
center Point (0.0, 0.0)
rotation float 1.5707963267948966

rectangle

rectangle

An axis-aligned rectangle centered on center.

from geomotif import save_svg
from geomotif.motifs import Rectangle

motif = Rectangle()
save_svg(motif.build(), "rectangle.svg", width=320, height=320)
geomotif render rectangle --out rectangle.svg
{
  "geomotif": "1.3.1",
  "motif": "rectangle",
  "params": {
    "width": 160.0,
    "height": 100.0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
width float 160.0
height float 100.0
center Point (0.0, 0.0)

rectangle.rounded

rectangle.rounded

A rectangle with its corners replaced by quarter circles.

from geomotif import save_svg
from geomotif.motifs import RoundedRectangle

motif = RoundedRectangle()
save_svg(motif.build(), "rectangle.rounded.svg", width=320, height=320)
geomotif render rectangle.rounded --out rectangle.rounded.svg
{
  "geomotif": "1.3.1",
  "motif": "rectangle.rounded",
  "params": {
    "width": 160.0,
    "height": 100.0,
    "corner_radius": 20.0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
width float 160.0
height float 100.0
corner_radius float 20.0
center Point (0.0, 0.0)

sector

sector

A pie slice: an arc closed back to its center by two radii.

from geomotif import save_svg
from geomotif.motifs import Sector

motif = Sector()
save_svg(motif.build(), "sector.svg", width=320, height=320)
geomotif render sector --out sector.svg
{
  "geomotif": "1.3.1",
  "motif": "sector",
  "params": {
    "radius": 100.0,
    "start_angle": 0.0,
    "sweep": 1.0471975511965976,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default
radius float 100.0
start_angle float 0.0
sweep float 1.0471975511965976
center Point (0.0, 0.0)

squircle

squircle

The square-circle midpoint: a Superellipse with n = 4.

from geomotif import save_svg
from geomotif.motifs import Squircle

motif = Squircle()
save_svg(motif.build(), "squircle.svg", width=320, height=320)
geomotif render squircle --out squircle.svg
{
  "geomotif": "1.3.1",
  "motif": "squircle",
  "params": {
    "resolution": null,
    "radius": 100.0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default Notes
radius float 100.0
center Point (0.0, 0.0)
resolution int | None None Segments per strand -- a strand gets one more point than that, so both ends are included. None (default) scales density with the winding.

star

star

The star people actually draw: outer points joined through inner ones.

from geomotif import save_svg
from geomotif.motifs import Star

motif = Star()
save_svg(motif.build(), "star.svg", width=320, height=320)
geomotif render star --out star.svg
{
  "geomotif": "1.3.1",
  "motif": "star",
  "params": {
    "points": 5,
    "inner_ratio": 0.382,
    "radius": 100.0,
    "center": [
      0.0,
      0.0
    ],
    "rotation": 1.5707963267948966
  }
}
Parameters
Name Type Default
points int 5
inner_ratio float 0.382
radius float 100.0
center Point (0.0, 0.0)
rotation float 1.5707963267948966

superellipse

superellipse

The curve |x/rx|**n + |y/ry|**n == 1, for any positive n.

from geomotif import save_svg
from geomotif.motifs import Superellipse

motif = Superellipse()
save_svg(motif.build(), "superellipse.svg", width=320, height=320)
geomotif render superellipse --out superellipse.svg
{
  "geomotif": "1.3.1",
  "motif": "superellipse",
  "params": {
    "resolution": null,
    "exponent": 2.5,
    "rx": 100.0,
    "ry": 100.0,
    "center": [
      0.0,
      0.0
    ]
  }
}
Parameters
Name Type Default Notes
exponent float 2.5
rx float 100.0
ry float 100.0
center Point (0.0, 0.0)
resolution int | None None Segments per strand -- a strand gets one more point than that, so both ends are included. None (default) scales density with the winding.