forked from inconvergent/snek
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex-plot-perspective.lisp
More file actions
executable file
·40 lines (30 loc) · 1.12 KB
/
ex-plot-perspective.lisp
File metadata and controls
executable file
·40 lines (30 loc) · 1.12 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
#!/usr/bin/sbcl --script
(load "src/load")
(setf *print-pretty* t)
(setf *random-state* (make-random-state t))
; note that this does not use the snek structure.
(defun main (size fn)
(let ((rad 0.07)
(rep 5)
(box-rep 10)
(left 150)
(right 850)
(plt (plot:make size)))
(let ((ddd (make-perspective-transform
(rnd:in-box 500 500 :xy (list -500 500))
(rnd:in-box 500 500 :xy (list 1500 500))
(rnd:in-box 500 500 :xy (list 500 1500)))))
(loop for x in (linspace left right rep) do
(loop for y in (linspace left right rep) do
(let ((points (funcall ddd
(list x y) rad rad (half rad) (half rad))))
(let ((top (subseq points 0 5))
(bottom (subseq points 5 10)))
(loop for s in (linspace 0.0 1.0 box-rep) do
(plot:path plt
(loop for a in top
for b in bottom
collect
(on-line s a b)))))))))
(plot:save plt fn)))
(time (main 1000 (second (cmd-args))))