-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspiral-shell.clj
More file actions
52 lines (48 loc) · 1.72 KB
/
spiral-shell.clj
File metadata and controls
52 lines (48 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
; === Spiral Shell ===
;
; A logarithmic spiral shell, like a snail or nautilus.
;
; The shell is built by lofting a circle along a helical path
; that expands as it spirals. The cross-section grows with each
; revolution, mimicking the natural growth pattern of mollusks.
; A noisy displacement adds organic surface texture.
;
; The key insight is using loft-n with a shape-fn that scales
; the cross-section proportionally to position along the path,
; combined with a helical path generated by arc-h + vertical lift.
;
; Demonstrates:
; - arc-h for helical paths (horizontal arcs + vertical offset)
; - loft-n with combined shape-fns (tapered + noisy)
; - Parametric spirals with growth ratio
; - Organic surface detail with procedural noise
;
; Try changing:
; - n-turns for more or fewer spiral revolutions
; - growth for how quickly the shell expands
; - tilt for the cone angle of the spiral
; - noise amplitude/scale for surface texture
(def n-turns 3)
(def steps-per-turn 48)
(def total-steps (* n-turns steps-per-turn))
(def initial-radius 3)
(def growth 2.8) ; radius multiplier over full spiral
(def spiral-radius 15) ; radius of the helical path
(def tilt 25) ; cone angle in degrees
; The helical path: spiraling outward and upward
(def helix
(path
(resolution :n steps-per-turn)
(tv tilt)
(dotimes [i total-steps]
(let [t (/ i total-steps)
r (* spiral-radius (+ 1.0 (* t (- growth 1.0))))]
(arc-h r (/ 360 steps-per-turn))))))
; Shell: loft a growing, slightly bumpy circle along the helix
(def shell
(loft-n total-steps
(-> (circle initial-radius 24)
(tapered :to growth)
(noisy :amplitude 0.3 :scale 5 :octaves 2))
(follow-path helix)))
(register shell shell)