Blame


1 12687dd9 2023-08-04 jrmu ;; The first three lines of this file were inserted by DrScheme. They record metadata
2 12687dd9 2023-08-04 jrmu ;; about the language level of this file in a form that our tools can easily process.
3 12687dd9 2023-08-04 jrmu #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 12687dd9 2023-08-04 jrmu savannah : posn posn radian -> true
5 12687dd9 2023-08-04 jrmu Given start, end, and angle, draw a savannah tree until the lines are too short, then return true.
6 12687dd9 2023-08-04 jrmu
7 12687dd9 2023-08-04 jrmu (define (savannah start end radian)
8 12687dd9 2023-08-04 jrmu (cond
9 12687dd9 2023-08-04 jrmu [(too-short? (distance start end)) ]
10 12687dd9 2023-08-04 jrmu []))
11 12687dd9 2023-08-04 jrmu
12 12687dd9 2023-08-04 jrmu ;distance : posn posn -> number
13 12687dd9 2023-08-04 jrmu ;Given p1, p2, determine the distance between two points.
14 12687dd9 2023-08-04 jrmu
15 12687dd9 2023-08-04 jrmu (define (distance p1 p2)
16 12687dd9 2023-08-04 jrmu (sqrt (+ (sqr (- (posn-x p2) (posn-x p1)))
17 12687dd9 2023-08-04 jrmu (sqr (- (posn-y p2) (posn-y p1))))))
18 12687dd9 2023-08-04 jrmu
19 12687dd9 2023-08-04 jrmu ;too-short? : number -> boolean
20 12687dd9 2023-08-04 jrmu ;Determine if the line is too short to be drawn further.