-
Notifications
You must be signed in to change notification settings - Fork 0
/
sphtest.lisp~
38 lines (36 loc) · 1.14 KB
/
sphtest.lisp~
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
(defun ray-test (filename &optional (res 1))
(setf *world* nil)
(defsphere 0 0 700 100 *green*)
; (defsphere 0 0 -200 1000 0.2)
(tracer (make-pathname :name filename) res))
(let ((test-count 1))
(defun reset-count ()
(setf test-count 0))
(defun test ()
(tracer (format nil "dynam1/test~d.pgm" test-count) 5)
(setf test-count (1+ test-count))))
(defun new-world ()
(setq *world* nil)
(do ((i 0 (1+ i)))
((= i 100))
(defsphere (- (random 800) 400) (- (random 600) 300) (+ (random 500) 700)
(+ (random 50) 50)
(nth (random 4) colors))))
(let ((count 0))
(defun next-count () (setf count (1+ count)))
(defun animate-rand (jump frames)
(dotimes (i frames)
(let ((nworld ()))
(dolist (obj *world*)
(let ((sphere (make-sphere
:radius (+ (sphere-radius obj) 20)
:center (pointwise-op #'+ (make-point
:x (+ 0 (random (* 2 jump)))
:y (+ 0 (random (* 2 jump)))
:z (+ 0 (random (* 2 jump))))
(sphere-center obj))
:color (sphere-color obj))))
(push sphere nworld)))
(setf *world* nworld))
(format t "Set ~dth world~%" i)
(test))))