Blob


1 ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 ;; about the language level of this file in a form that our tools can easily process.
3 #reader(lib "htdp-intermediate-lambda-reader.ss" "lang")((modname |27.1|) (read-case-sensitive #t) (teachpacks ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp"))) (htdp-settings #(#t constructor repeating-decimal #f #t none #f ((lib "draw.ss" "teachpack" "htdp") (lib "arrow.ss" "teachpack" "htdp") (lib "gui.ss" "teachpack" "htdp")))))
4 savannah : posn posn radian -> true
5 Given start, end, and angle, draw a savannah tree until the lines are too short, then return true.
7 (define (savannah start end radian)
8 (cond
9 [(too-short? (distance start end)) ]
10 []))
12 ;distance : posn posn -> number
13 ;Given p1, p2, determine the distance between two points.
15 (define (distance p1 p2)
16 (sqrt (+ (sqr (- (posn-x p2) (posn-x p1)))
17 (sqr (- (posn-y p2) (posn-y p1))))))
19 ;too-short? : number -> boolean
20 ;Determine if the line is too short to be drawn further.