• This repository has been archived on 11/Apr/2020
  • Stars
    star
    733
  • Rank 61,835 (Top 2 %)
  • Language
    Common Lisp
  • License
    Other
  • Created almost 8 years ago
  • Updated about 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

See https://github.com/inconvergent/weir instead

SNEK-A System for Making Generative Systems

About

This library is specifically written to be useful for a broad range of ways in which I create art using various generative algorithms.

head

In short snek is four things:

  1. A simple (graph) data structure for working with vertices and edges The structure is named snek; the name is explained below. This structure is combined with a programming pattern for applying changes to the structure. The pattern relies on alterations, see below.

  2. A series of useful data structures and tools. E.g. a 2D vector vec, a package for generating different kinds of random numbers: rnd, as well as tools for handling colors (pigment), splines (bzspl), and various vector an path functionality (math, lin-path).

  3. A tool for drawing things called sandpaint. sandpaint uses random sampling to draw its primitives. This creates a fairly distinct and gritty look in many cases.

  4. A tool for drawing svg files (draw-svg). Mainly svg files that are good for plotting.

head

About the Name

A while back someone on Twitter suggested that if Python 3 was named "snek" it would avoid naming confusion. I found that amusing at the time, and picked snek as the placeholder name for this project. I've been looking for a better name, but I haven't found one yet.

Alterations

The pattern depends on the concept of alterations. In short: an alteration is a change that will be applied to the structure at the end of a given context. alterations are further described in https://inconvergent.net/2017/snek-is-not-an-acronym/.

I have also written about things related to snek at

Here is and example of manipulating a snek instance called snk using alterations. Alteration constructors are postfixed with ?.

; context start
(snek:with (snk)
  ; iterate vertices
  (snek:itr-verts (snk v)
    ; move alteration
    (snek:move-vert? v (rnd:in-circ 1d0))
    ; w will be an arbitrary
    ; vertex in snk
    (snek:with-rnd-vert (snk w)
      ; join v and w if they are closer than d
      (if (< (snek:edge-length snk v w) d)
        ; join vertices alteration
        (snek:add-edge? v w))))
; context end
; alterations have been applied

You can also manipulate the state directly. These functions are postfixed with !. Eg. (snek:move-vert! ...).

Examples

There are some examples included. All examples are in the examples folder.

If you don't provide a filename (with full or relative path) as the first argument, the resulting file will be named ./tmp.png.

Custom alterations

You can define your own arbitrary alterations. There is an example of this in ex/custom-alt.lisp. I have also written about it here: https://inconvergent.net/2017/arbitrary-alterations/

Usage

I use snek for most of the work that I post online (https://twitter.com/inconvergent). Both for generating raster images as well as vector images for plotter drawings.

lines

lines

Here are some plotted examples:

Dependencies

This code requires libpng-dev, Quicklisp, zpng, cl-svg and cl-png. The path to quicklisp must be set in src/load. zpng, cl-svg and cl-png are automatically installed via quicklisp.

Tests

There are some tests included, see the test folder.

Stability, Changes and Versioning

This code is highly experimental on my part. It is likely to change with no warning or explanation. I will keep a note of the version number in src/load.lisp.

Thanks

I would like to thank:

Who have provided me with useful hints and code feedback.

More Repositories

1

weird

Generative art in Common Lisp
Common Lisp
1,563
star
2

differential-line

a generative algorithm
Python
674
star
3

weir

(deprecated) A system for making generative systems
Common Lisp
633
star
4

sand-spline

generative algorithm
Python
299
star
5

svgsort

svg path sorter for more efficient (pen)plotting.
Python
241
star
6

tree

An algorithm that draws procedurally generated trees.
Python
183
star
7

fracture

generative algorithm
Python
119
star
8

inconvergent-sandbox

Interactive demos written in p5.js
JavaScript
115
star
9

hyphae

Python
97
star
10

gridfont

grid-based system for designing simple symbols and fonts. including an example font. mainly intended for plotter drawings.
Python
95
star
11

fn

python library for generating file names based on current time and git commit.
Python
89
star
12

differential-mesh

generative algorithm
Python
84
star
13

differential-lattice

a generative algorithm using CUDA
Python
73
star
14

desert

A fast (?) random sampling drawing library
Python
65
star
15

differential-mesh-3d

a generative algorithm
Python
55
star
16

hyphae_ani

generative algorithm
Python
49
star
17

orbitals

A generative algorithm. See inconvergent/orbitals_speedup
Python
48
star
18

sand-glyphs

generative algorithm
Python
46
star
19

cl-grph

In-Memory Immutable Graph Structure with Datalog Query Language in Common Lisp
Common Lisp
45
star
20

linearx-font

Procedurally generated fonts
Python
44
star
21

auxin

Auxiliary Common Lisp Utilities for Generative Art
Common Lisp
43
star
22

cl-veq

Vector mathematics DSL and utilities in Common Lisp
Common Lisp
41
star
23

boids

More or less an implementation of Boids flocking algorithm.
Python
36
star
24

orbitals_speedup

Python
36
star
25

simple-circle-packing

brief intro to python + cairo for visualization/drawing
Python
33
star
26

leaf-cuda

leaf venation algorithm. work in progress
Python
28
star
27

axidraw-xy

WARNING: THIS IS OUTDATED AND UNMAINTAINED.
Python
27
star
28

fast-sand-paint

fast wrapper around some pixel manipulation
Python
26
star
29

tracepath-spline

A generative algorithm that draws wave-like lines.
Python
24
star
30

fracture-cuda

Python
22
star
31

differential-line-cuda

CUDA implementation of Differential Line
Python
20
star
32

svg-sorter

spatially sorts all lines in a svg, and creates new svg that is reasonably efficient for plotting.
Python
17
star
33

render

[unmaintained] helpers used to draw and animate with python (cairo)
Python
14
star
34

talks

Notes from presentations I've given.
Python
14
star
35

iutils

[DEPRECATED] utility functions for several generative algorithms.
Python
11
star
36

wind

Python
10
star
37

ddd-utils

[unmaintained] helpers used in various generative algorithm pieces (random, vectors, import/export)
Python
9
star
38

zonemap

unmaintained
Python
8
star
39

automata

unmaintained
Python
7
star
40

differential_ani

[outdated, see https://github.com/inconvergent/differential-line]
Python
7
star
41

differential-cloud

Work in progress.
Python
7
star
42

leaf

Python
6
star
43

xmsmfem

A parallel Multiscale Mixed Finite Element Method for the Matlab Reservoir Toolbox using the Matlab Parallel Computing Toolbox
MATLAB
6
star
44

annotate

adhoc system for annotating image quality and storing the result in a csv
Python
5
star
45

orbitals_ani

A generative algorithm.
Python
5
star
46

sand-pillars

unmaintained
Python
5
star
47

differential-line-mpi

Python
5
star
48

brush-test

JavaScript
4
star
49

sand-dunes

unmaintained
Python
4
star
50

inconvergent

4
star
51

zet

Python
3
star
52

ccvt

Python
3
star
53

zonemap-3d

unmaintained
Python
2
star
54

kinect-glitter

JavaScript
2
star
55

win-vin

2
star
56

jqn

JSON query and transform terminal utility and Common Lisp library
Common Lisp
2
star
57

stacker

Python
1
star
58

orbitals_multicanvas

Python
1
star
59

stm

Finite State Machine Utilities
Common Lisp
1
star