; Animated 3D graphics :-) ; load memo "Graphic utilities" before ; eval for example ; (cube 80 30 30 12 35) (define (cube xc yc xr yr h) (letrec ((iter (lambda (a) (set-pattern #t) (draw-cube a) (wait 50) (set-pattern #f) (move (- xc xr) (- yc yr)) (rect (+ (+ xc xr) 1) (+ (+ yc yr) (+ h 1)) 0) (iter (+ a 0.15)))) (draw-cube (lambda (a) (let ((c (cos a)) (s (sin a))) (let ((dxs (integer (* s xr))) (dxc (integer (* c xr))) (dys (integer (* s yr))) (dyc (integer (* c yr)))) (let ((x1 (+ xc dxc)) (y1 (+ yc dys)) (x2 (- xc dxs)) (y2 (+ yc dyc)) (x3 (- xc dxc)) (y3 (- yc dys)) (x4 (+ xc dxs)) (y4 (- yc dyc))) (let ((y1h (+ y1 h)) (y2h (+ y2 h)) (y3h (+ y3 h)) (y4h (+ y4 h))) (move x1 y1) (draw x2 y2) (draw x3 y3) (draw x4 y4) (draw x1 y1) (draw x1 y1h) (draw x2 y2h) (draw x3 y3h) (draw x4 y4h) (draw x1 y1h) (move x2 y2) (draw x2 y2h) (move x3 y3) (draw x3 y3h) (move x4 y4) (draw x4 y4h) ))))))) (cls) (iter 0)))