# 160c Schotter

Based on Schotter by Georg Nees (23 June 1926 - 3 January 2016)

```
(meta linear-colour-space: 1)
(render-background)
(render-main)
(define
num-squares-to-render {25 (gen/int min: 14 max: 40)}
gap-size {2 (gen/int min: 0 max: 10)}
num-squares (+ 2 num-squares-to-render)
num-gaps (+ num-squares 1)
square-size (/ (- canvas/width (* gap-size num-gaps)) num-squares)
focal-point ({focal/build-hline (gen/select from: '(focal/build-point
focal/build-hline
focal/build-vline))}
position: [{500 (gen/select from: '(0 500 1000))}
{0 (gen/select from: '(0 500 1000))}]
distance: {1300 (gen/scalar min: 300 max: 1300)})
rng-fn (prng/build min: -1 max: 1 seed: 454)
box-colour (col/rgb r: 0.2 g: 0.2 b: 0.2 alpha: 0.7))
(fn (stroked-box seed: 0
volatility: 0)
(define
half-size+ (/ square-size 2)
half-size- (* half-size+ -1)
thickness {1.2 (gen/scalar min: 0.9 max: 3.0)}
half-thickness (/ thickness 2))
(on-matrix-stack
;; displace the box according to volatility
(rotate angle: (* (prng/value from: rng-fn) volatility {135.923 (gen/scalar min: 0 max: 200)}))
(translate vector: [(* (prng/value from: rng-fn) volatility {1.826 (gen/scalar min: 0 max: 100)})
(* (prng/value from: rng-fn) volatility {29.980 (gen/scalar min: 0 max: 100)})])
;; draw a box around the origin
(line from: [(+ half-size- half-thickness) half-size-]
to: [(- half-size+ half-thickness) half-size-]
width: thickness
colour: box-colour)
(line from: [half-size+ (- half-size- half-thickness)]
to: [half-size+ (+ half-size+ half-thickness)]
width: thickness
colour: box-colour)
(line from: [(- half-size+ half-thickness) half-size+]
to: [(+ half-size- half-thickness) half-size+]
width: thickness
colour: box-colour)
(line from: [half-size- (+ half-size+ half-thickness)]
to: [half-size- (- half-size- half-thickness)]
width: thickness
colour: box-colour)))
(fn (map-to-position at: 0)
(- (+ (* (+ gap-size square-size) at) (/ square-size 2) gap-size)
(/ canvas/height 2)))
(fn (render-main)
(define
x-sub {7 (gen/int min: 1 max: 8)}
y-sub {1 (gen/int min: 1 max: 8)})
(on-matrix-stack
(translate vector: [(/ canvas/width 2) (/ canvas/height 2)])
(loop (y from: y-sub to: (- num-squares y-sub))
(loop (x from: x-sub to: (- num-squares x-sub))
(define
position [(map-to-position at: x) (map-to-position at: y)])
(on-matrix-stack
(translate vector: position)
(stroked-box seed: (+ x (* y num-squares))
volatility: (focal/value from: focal-point position: position)))))))
(fn (render-background colour: (col/rgb r: 1 g: 1 b: 0.9))
(rect position: [(/ canvas/width 2) (/ canvas/height 2)]
width: canvas/width
height: canvas/height
colour: colour))
```

Variations from the same script: