;;; Scheme Recursive Art Contest Entry ;;; ;;; Please do not include your name or personal info in this file. ;;; ;;; Title: ;;; ;;; Description: ;;; ; (define (circle-recursion x y) ; (if (and (< x 100) (< y 100)) ; (begin (penup) (goto x y) (pendown) (circle 5) (circle-recursion (+ x 3) (+ y 3))))) ; (define (draw) ; (circle-recursion 0 0) ; (exitonclick)) (define (draw) ; (hideturtle) ; (speed 0) ; (goto 500 0) ; (begin_fill) ; (circle 500) ; (end_fill) ; (define (move-spirals head) ; (penup) ; (goto 0 0) ; (pendown) ; (define orig-heading head) ; (define (rainbow size heading inc red green blue) ; (color (rgb red green blue)) ; (setheading heading) ; (forward (/ inc 2)) ; (pendown) ; (circle size) ; (circle (/ size 2)) ; (forward (/ inc 2)) ; (begin_fill) ; (circle (/ size 2)) ; (end_fill) ; (cond ; ((> heading (+ 360 orig-heading)) nil) ; ((and (= red .9) (< green .9) (<= blue .1)) (rainbow (* size 1.17) (+ heading 10) (* inc 1.21) .9 (+ green .11) .1)) ; ((and (>= red .1) (>= green .9) (= blue .1)) (rainbow (* size 1.17) (+ heading 10) (* inc 1.21) (- red .125) .9 .1)) ; ((and (<= red .1) (= green .9) (< blue .9)) (rainbow (* size 1.17) (+ heading 10) (* inc 1.21) .1 .9 ( + blue .11))) ; ((and (= red .1) (>= green .1) (>= blue .9)) (rainbow (* size 1.17) (+ heading 10) (* inc 1.21) .1 (- green .11) .9)) ; ((and (<= red .9) (<= green .1) (= blue .9)) (rainbow (* size 1.17) (+ heading 10) (* inc 1.21) (+ red .11) .1 .9)) ; ((and (>= red .9) (= green .1) (>= blue .1)) (rainbow (* size 1.17) (+ heading 10) (* inc 1.21) .9 .1 (- blue .11))) ; ) ; ) ; (rainbow 1.2 head 1.2 .9 .1 .1) ; (cond ; ((> head 360) nil) ; (else (move-spirals (+ head 20))) ; ) ; ) ; (move-spirals 0) (define (rcos theta) (cos (* theta (/ 3.141592653589 180)))) (define (rsin theta) (sin (* theta (/ 3.141592653589 180)))) (define (spiral init-x init-y xcoord ycoord spiral-inc num-spirals theta) (define (ellipse a b x-inc counter) (speed 10) (define (slope x y) (/ (* (- 0 x) b b) (* y a a))) (define (mover x y)(begin (pendown) (goto (+ x xcoord) (+ y ycoord)) (cond ((< (- (* (rcos theta) a) x) (/ x-inc 5)) (begin (if (not (= theta 0)) (penup)) (neg-mover (- 0 new-x) (- 0 (y-of-x (- 0 new-x)))))) (else (mover (+ x x-inc) (+ y (* (slope x y) x-inc))))))) (define (neg-mover x y)(begin (goto (+ x xcoord) (+ y ycoord)) (pendown) (cond ((> (- x (- 0 a))(/ x-inc 5)) (neg-mover (- x x-inc) (- y (* (slope x y) x-inc)))) (else (begin (goto (+ new-x xcoord) (+ ycoord (y-of-x new-x))) (if (< counter num-spirals) (ellipse (- 0 (+ x (* spiral-inc x-inc))) (* b (/ (- 0 (+ x (* spiral-inc x-inc))) a)) x-inc (+ counter 1)))))))) (define new-x (+ (- 0 a) (/ x-inc 10))) (define (y-of-x x) (expt (* b b (- 1 (/ (* new-x new-x) (* a a)))) 0.5)) (penup) (goto (+ xcoord (- 0 a)) ycoord) (mover new-x (y-of-x new-x))) (ellipse init-x init-y 1 1)) (define (note xsize ysize x0 y0 theta) ; (showturtle) ; (begin_fill) ; (circle radius -270) ; (goto (- x0 radius) (+ y0 radius)) ; (right 90) ; (forward (* 5 radius)) ; (right 90) ; (forward radius) ; (goto x0 y0) ; (end_fill)) ; (note 10 0 0 30) (begin_fill) (penup) (spiral xsize ysize x0 y0 1 1 theta) (end_fill) (penup) (define x (+ x0 (* xsize (rcos theta)))) (define y (+ y0 (* ysize (rsin theta)))) (begin_fill) (goto x y) (pendown) (goto x (+ y (* 5 ysize))) (goto (+ xsize x0) (+ y (* 5 ysize))) (goto (+ xsize x0) y0) (end_fill)(penup)(goto (+ xsize x0) (+ y (* 5 ysize)))) (define (double-note xsize ysize x0 y0 theta width angle) (define x (+ x0 (* xsize (rcos theta)))) (define y (+ y0 (* ysize (rsin theta)))) (note xsize ysize x0 y0 theta) (begin_fill) (setheading (+ 90 angle)) (forward width) (setheading 180) (forward ysize) (setheading (+ 270 angle)) (forward width) (setheading 0) (forward ysize) (end_fill) (note xsize ysize (+ x0 (* width (rcos angle))) (- y0 (* width (rsin angle))) theta)) ; (doublenote 15 10 50 50 40 40 20) ; (note 15 10 100 100 40) (define (vinyl num-spirals) (spiral 200 50 0 -200 5 num-spirals 0) (begin_fill) (color "#ffff00") (spiral (- 200 (* 5 num-spirals)) (* (expt 0.975 num-spirals) 50) 0 -200 1 1 0) (end_fill)) (define (note-trail-line slope xcoord ycoord) (penup) (goto xcoord ycoord) (if (< (abs xcoord) 300) (begin (if (= (modulo ycoord (* 50 slope)) 0) (note (* (+ 1 (/ (abs xcoord) 300)) 10) (* (+ 1 (/ (abs xcoord) 300)) 7) xcoord ycoord 40)) (note-trail-line slope (+ xcoord 5) (+ ycoord (* slope 5)) )) )) (define (double-note-trail-line slope xcoord ycoord) (penup) (goto xcoord ycoord) (if (< (abs xcoord) 300) (begin (if (= (modulo ycoord (* 50 slope)) 0) (double-note (* (+ 1 (/ (abs xcoord) 300)) 10) (* (+ 1 (/ (abs xcoord) 300)) 7) xcoord ycoord 40 30 20)) (double-note-trail-line slope (- xcoord 5) (+ ycoord (* slope 5)))) )) (double-note-trail-line 2 0 -100) (note-trail-line 0.5 0 -100) (note-trail-line 2 0 -100) (double-note-trail-line 0.5 0 -100) (vinyl 30) (exitonclick)) ; Please leave this last line alone. You may add additional procedures above ; this line. (draw)