Question: Exercise 27.1.1 Develop the functions 1. ; draw-triangle: posn posn posntrue 2. ; too-small? Use the teachpack draw.ss to test the code. For a first

 Exercise 27.1.1 Develop the functions 1. ; draw-triangle: posn posn posntrue
2. ; too-small? Use the teachpack draw.ss to test the code. For

Exercise 27.1.1 Develop the functions 1. ; draw-triangle: posn posn posntrue 2. ; too-small? Use the teachpack draw.ss to test the code. For a first test of the com- posn posn posn bool to complete the definitions in figure 72. plete function, use the following definitions: (define A (make-posn 200 0) (define B (make-posn 27 300)) (define C (make-posn 373 300) :i sierpinski : posn posn posn true ;i to draw a Sierpinski triangle down at a, b, and c, " assuming it is large enough (define (sierpinski a b c) (cond [(too-small? a b c) true] else (local (define a-b (mid-point a b)) (define b-c (mid-point bc) (define c-a (mid-point a c)) (and draw-triangle a b c) (sierpinski a a-b c-a) (sierpinski ba-bb-c) (sierpinski c c-a b-c))I) ; mid-point : posn posn posn (define (mid-point a-posn b-posn) " to compute the mid-point between a-posn and b-posn (make-posn (mid (posn-x a-posn) (posn-x b-posn)) (mid (posn-y a-posn) (posn-y b-posn) ;; mid : number number number : to compute the average of x andy (define (mid x y) Figure 72: The Sierpinski algorithm

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!