;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: Pole -err, i mean Polar- Dancing ;;; ;;; Description: ;;; (define (draw) (define pi 3.14159) (define (sin y) (define (appsin x n1 n2) (define (fact n) (if (<= n 0) 1 (* n (fact (- n 1))))) (define (power x n) (if (<= n 0) 1 (* x (power x (- n 1))))) (define num (+ 1 (* 2 n1))) (define term (/ (power x num)(fact num))) (cond ((eq? n1 n2) 0) ((even? n1) (+ (appsin x (+ 1 n1) n2) term)) (else (- (appsin x (+ 1 n1) n2) term)) ) ) (appsin (modulo y (* 2 pi)) 0 10) ) (define (cos y) (sin (+ y (* pi 0.5)))) (define (getx r theta) (* r (cos theta))) (define (gety r theta) (* r (sin theta))) (define (mycolor n) (cond ((eq? (modulo n 6) 0) 'red) ((eq? (modulo n 6) 1) 'orange) ((eq? (modulo n 6) 2) 'yellow) ((eq? (modulo n 6) 3) 'green) ((eq? (modulo n 6) 4) 'blue) (else 'purple)) ) (define (radtodeg ang) (* pi (/ ang 180))) (define (draw-func tfunc rfunc base-x base-y rot) (define (draw-increment t max incr) (cond ((> t (+ incr max)) nil) (else (goto (+ base-x (getx (rfunc t)(tfunc t))) (+ base-y (gety (rfunc t)(tfunc t)))) (pendown)(draw-increment (+ t incr) max incr)) ) ) (draw-increment -0.025 (* 2 rot pi) 0.025)(penup) ) (define (draw-all-the-funcs tfro var-rfro min max x y rot incr col) (if (<= max min) nil (begin (penup)(goto x y)(color (mycolor col)) (draw-func tfro (var-rfro (- max incr)) x y rot) (draw-all-the-funcs tfro var-rfro min (- max incr) x y rot incr col))) ) (color 'black) (speed 0)(setheading 0) (goto -240 360)(begin_fill) (goto 240 360)(goto 240 -360)(goto -240 -360)(goto -240 360)(end_fill) (define (roseonet t) t) (define (roseoner c) (lambda t (* c (+ 2 (sin (* 6 t)))))) (define (rosetwot t) (+ t pi)) (define (rosetwor c) (lambda t (* 22.8 (+ 1 (* 3 (sin (* c t))))))) (define (rosethrt t) t) (define (rosethrr c) (lambda t (* 22.8 (+ (sin t)(cos (* c t)))))) (define (rosefout t) t) (define (rosefour c) (lambda t (* c (- 3 (* 2 (sin (* 9 (sin t)))))))) (define (spiralt t) (+ (radtodeg 225) t)) (define (spiralr c) (lambda t (* 10.8 (+ t (sin (* c t)))))) (define (spiralralt c) (lambda t (* 1.5 ((spiralr c) t)))) (define (spiralralts c) (lambda t (* 0.85 ((spiralr c) t)))) (define (spiraltalt t)(- (radtodeg 180) (spiralt t))) (draw-all-the-funcs spiralt spiralralt 0 5 90 -204 1 1 3) (draw-all-the-funcs spiralt spiralr 0 5 54 120 1 1 3) (draw-all-the-funcs spiralt spiralr 0 5 54 -27 1 1 3) (draw-all-the-funcs spiraltalt spiralr 0 5 -60 -114 1 1 3) (draw-all-the-funcs spiraltalt spiralr 0 5 -78 51 1 1 3) (draw-all-the-funcs spiraltalt spiralralts 0 5 -69 174 1 1 3) (draw-all-the-funcs rosethrt rosethrr 1 8 0 201 1 2 4) (draw-all-the-funcs rosethrt rosethrr 1 8 -30 96 1 2 4) (draw-all-the-funcs rosethrt rosethrr 1 8 0 0 1 2 4) (draw-all-the-funcs roseonet roseoner 21 25 -108 246 1 2 0) (draw-all-the-funcs rosetwot rosetwor 7 8 90 165 1 1 1) (draw-all-the-funcs rosetwot rosetwor 7 8 -111 24 0.5 1 2) (draw-all-the-funcs rosefout rosefour 11.5 13 78 -48 1 0.5 5) (hideturtle) (exitonclick)) ; Please leave this last line alone. You may add additional procedures above ; this line. All Scheme tokens in this file (including the one below) count ; toward the token limit. (draw)