git.haldean.org plotter / 51d187d
messing with tri pattern Haldean Brown 3 years ago
2 changed file(s) with 17 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
99 (defun vec* (s v) (cons (* s (car v)) (* s (cdr v))))
1010 (defun dot (v1 v2) (+ (* (car v1) (car v2)) (* (cdr v1) (cdr v2))))
1111 (defun norm (v) (sqrt (dot v v)))
12 (defun normalize (v) (vec* (/ 1 (norm v)) v))
1213
1314 (defun eval-bezier (theta pts)
1415 (if (= 1 (length pts))
0 (load "package.lisp")
1 (load "bezier.lisp")
2 (load "svg.lisp")
3
4 (ql:quickload :alexandria)
5
6 (defun add-edge (edges)
7 (let* ((seed (alexandria:random-elt edges))
8 (edge-hlen (choose-edge-hlen))
9 (center (vec* 0.5 (vec+ (first seed) (second seed))))
10 (v (normalize (vec- (second seed) (first seed))))
11 (p1 (vec- center (vec* edge-hlen v)))
12 (p2 (vec+ center (vec* edge-hlen v)))
13 )
14
15 ))